
kernel:     file format elf32-i386


Disassembly of section .text:

00100000 <main>:
static void mpmain(void) __attribute__((noreturn));

// Bootstrap processor starts running C code here.
int
main(void)
{
  100000:	55                   	push   %ebp
  100001:	89 e5                	mov    %esp,%ebp
  100003:	53                   	push   %ebx
  100004:	83 e4 f0             	and    $0xfffffff0,%esp
  100007:	83 ec 10             	sub    $0x10,%esp
  mpinit(); // collect info about this machine
  10000a:	e8 f1 28 00 00       	call   102900 <mpinit>
  lapicinit(mpbcpu());
  10000f:	e8 cc 28 00 00       	call   1028e0 <mpbcpu>
  100014:	89 04 24             	mov    %eax,(%esp)
  100017:	e8 e4 25 00 00       	call   102600 <lapicinit>
  ksegment();
  10001c:	e8 1f 31 00 00       	call   103140 <ksegment>
  picinit();       // interrupt controller
  100021:	e8 fa 2a 00 00       	call   102b20 <picinit>
  ioapicinit();    // another interrupt controller
  100026:	e8 f5 21 00 00       	call   102220 <ioapicinit>
  10002b:	90                   	nop
  10002c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  consoleinit();   // I/O devices & their interrupts
  100030:	e8 2b 09 00 00       	call   100960 <consoleinit>
  uartinit();      // serial port
  100035:	e8 46 51 00 00       	call   105180 <uartinit>
cprintf("cpus %p cpu %p\n", cpus, cpu);
  10003a:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
  100040:	c7 44 24 04 80 ba 10 	movl   $0x10ba80,0x4(%esp)
  100047:	00 
  100048:	c7 04 24 3e 61 10 00 	movl   $0x10613e,(%esp)
  10004f:	89 44 24 08          	mov    %eax,0x8(%esp)
  100053:	e8 f8 05 00 00       	call   100650 <cprintf>
  cprintf("\ncpu%d: starting xv6\n\n", cpu->id);
  100058:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
  10005e:	0f b6 00             	movzbl (%eax),%eax
  100061:	c7 04 24 4e 61 10 00 	movl   $0x10614e,(%esp)
  100068:	89 44 24 04          	mov    %eax,0x4(%esp)
  10006c:	e8 df 05 00 00       	call   100650 <cprintf>

  kinit();         // physical memory allocator
  100071:	e8 ba 23 00 00       	call   102430 <kinit>
  pinit();         // process table
  100076:	e8 d5 2f 00 00       	call   103050 <pinit>
  10007b:	90                   	nop
  10007c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  tvinit();        // trap vectors
  100080:	e8 7b 4d 00 00       	call   104e00 <tvinit>
  binit();         // buffer cache
  100085:	e8 e6 00 00 00       	call   100170 <binit>
  fileinit();      // file table
  10008a:	e8 61 0d 00 00       	call   100df0 <fileinit>
  10008f:	90                   	nop
  iinit();         // inode cache
  100090:	e8 0b 14 00 00       	call   1014a0 <iinit>
  ideinit();       // disk
  100095:	e8 86 1f 00 00       	call   102020 <ideinit>
  if(!ismp)
  10009a:	a1 64 ba 10 00       	mov    0x10ba64,%eax
  10009f:	85 c0                	test   %eax,%eax
  1000a1:	0f 84 b1 00 00 00    	je     100158 <main+0x158>
    timerinit();   // uniprocessor timer
  userinit();      // first user process
  1000a7:	e8 64 32 00 00       	call   103310 <userinit>
  struct cpu *c;
  char *stack;

  // Write bootstrap code to unused memory at 0x7000.
  code = (uchar*)0x7000;
  memmove(code, _binary_bootother_start, (uint)_binary_bootother_size);
  1000ac:	c7 44 24 08 6a 00 00 	movl   $0x6a,0x8(%esp)
  1000b3:	00 
  1000b4:	c7 44 24 04 34 87 10 	movl   $0x108734,0x4(%esp)
  1000bb:	00 
  1000bc:	c7 04 24 00 70 00 00 	movl   $0x7000,(%esp)
  1000c3:	e8 38 3c 00 00       	call   103d00 <memmove>

  for(c = cpus; c < cpus+ncpu; c++){
  1000c8:	69 05 60 c0 10 00 bc 	imul   $0xbc,0x10c060,%eax
  1000cf:	00 00 00 
  1000d2:	05 80 ba 10 00       	add    $0x10ba80,%eax
  1000d7:	3d 80 ba 10 00       	cmp    $0x10ba80,%eax
  1000dc:	76 75                	jbe    100153 <main+0x153>
  1000de:	bb 80 ba 10 00       	mov    $0x10ba80,%ebx
  1000e3:	90                   	nop
  1000e4:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    if(c == cpus+cpunum())  // We've started already.
  1000e8:	e8 03 26 00 00       	call   1026f0 <cpunum>
  1000ed:	69 c0 bc 00 00 00    	imul   $0xbc,%eax,%eax
  1000f3:	05 80 ba 10 00       	add    $0x10ba80,%eax
  1000f8:	39 c3                	cmp    %eax,%ebx
  1000fa:	74 3e                	je     10013a <main+0x13a>
      continue;

    // Fill in %esp, %eip and start code on cpu.
    stack = kalloc(KSTACKSIZE);
  1000fc:	c7 04 24 00 10 00 00 	movl   $0x1000,(%esp)
  100103:	e8 78 23 00 00       	call   102480 <kalloc>
    *(void**)(code-4) = stack + KSTACKSIZE;
    *(void**)(code-8) = mpmain;
  100108:	c7 05 f8 6f 00 00 00 	movl   $0x102800,0x6ff8
  10010f:	28 10 00 
    if(c == cpus+cpunum())  // We've started already.
      continue;

    // Fill in %esp, %eip and start code on cpu.
    stack = kalloc(KSTACKSIZE);
    *(void**)(code-4) = stack + KSTACKSIZE;
  100112:	05 00 10 00 00       	add    $0x1000,%eax
  100117:	a3 fc 6f 00 00       	mov    %eax,0x6ffc
    *(void**)(code-8) = mpmain;
    lapicstartap(c->id, (uint)code);
  10011c:	0f b6 03             	movzbl (%ebx),%eax
  10011f:	c7 44 24 04 00 70 00 	movl   $0x7000,0x4(%esp)
  100126:	00 
  100127:	89 04 24             	mov    %eax,(%esp)
  10012a:	e8 41 26 00 00       	call   102770 <lapicstartap>
  10012f:	90                   	nop

    // Wait for cpu to get through bootstrap.
    while(c->booted == 0)
  100130:	8b 83 a8 00 00 00    	mov    0xa8(%ebx),%eax
  100136:	85 c0                	test   %eax,%eax
  100138:	74 f6                	je     100130 <main+0x130>

  // Write bootstrap code to unused memory at 0x7000.
  code = (uchar*)0x7000;
  memmove(code, _binary_bootother_start, (uint)_binary_bootother_size);

  for(c = cpus; c < cpus+ncpu; c++){
  10013a:	69 05 60 c0 10 00 bc 	imul   $0xbc,0x10c060,%eax
  100141:	00 00 00 
  100144:	81 c3 bc 00 00 00    	add    $0xbc,%ebx
  10014a:	05 80 ba 10 00       	add    $0x10ba80,%eax
  10014f:	39 c3                	cmp    %eax,%ebx
  100151:	72 95                	jb     1000e8 <main+0xe8>
    timerinit();   // uniprocessor timer
  userinit();      // first user process
  bootothers();    // start other processors

  // Finish setting up this processor in mpmain.
  mpmain();
  100153:	e8 a8 26 00 00       	call   102800 <mpmain>
  binit();         // buffer cache
  fileinit();      // file table
  iinit();         // inode cache
  ideinit();       // disk
  if(!ismp)
    timerinit();   // uniprocessor timer
  100158:	e8 43 4c 00 00       	call   104da0 <timerinit>
  10015d:	8d 76 00             	lea    0x0(%esi),%esi
  100160:	e9 42 ff ff ff       	jmp    1000a7 <main+0xa7>
  100165:	90                   	nop
  100166:	90                   	nop
  100167:	90                   	nop
  100168:	90                   	nop
  100169:	90                   	nop
  10016a:	90                   	nop
  10016b:	90                   	nop
  10016c:	90                   	nop
  10016d:	90                   	nop
  10016e:	90                   	nop
  10016f:	90                   	nop

00100170 <binit>:
  struct buf head;
} bcache;

void
binit(void)
{
  100170:	83 ec 1c             	sub    $0x1c,%esp
  struct buf *b;

  initlock(&bcache.lock, "bcache");
  100173:	c7 44 24 04 c0 5c 10 	movl   $0x105cc0,0x4(%esp)
  10017a:	00 
  10017b:	c7 04 24 40 88 10 00 	movl   $0x108840,(%esp)
  100182:	e8 29 39 00 00       	call   103ab0 <initlock>

  // Create linked list of buffers
  bcache.head.prev = &bcache.head;
  bcache.head.next = &bcache.head;
  100187:	b9 64 9d 10 00       	mov    $0x109d64,%ecx
  for(b = bcache.buf; b < bcache.buf+NBUF; b++){
  10018c:	b8 74 88 10 00       	mov    $0x108874,%eax
  struct buf *b;

  initlock(&bcache.lock, "bcache");

  // Create linked list of buffers
  bcache.head.prev = &bcache.head;
  100191:	c7 05 70 9d 10 00 64 	movl   $0x109d64,0x109d70
  100198:	9d 10 00 
  bcache.head.next = &bcache.head;
  10019b:	c7 05 74 9d 10 00 64 	movl   $0x109d64,0x109d74
  1001a2:	9d 10 00 
  1001a5:	eb 05                	jmp    1001ac <binit+0x3c>
  1001a7:	90                   	nop
  for(b = bcache.buf; b < bcache.buf+NBUF; b++){
  1001a8:	89 c1                	mov    %eax,%ecx
  1001aa:	89 d0                	mov    %edx,%eax
    b->next = bcache.head.next;
  1001ac:	89 48 10             	mov    %ecx,0x10(%eax)
    b->prev = &bcache.head;
  1001af:	c7 40 0c 64 9d 10 00 	movl   $0x109d64,0xc(%eax)
    b->dev = -1;
  1001b6:	c7 40 04 ff ff ff ff 	movl   $0xffffffff,0x4(%eax)
    bcache.head.next->prev = b;
  1001bd:	8b 15 74 9d 10 00    	mov    0x109d74,%edx
  1001c3:	89 42 0c             	mov    %eax,0xc(%edx)
  initlock(&bcache.lock, "bcache");

  // Create linked list of buffers
  bcache.head.prev = &bcache.head;
  bcache.head.next = &bcache.head;
  for(b = bcache.buf; b < bcache.buf+NBUF; b++){
  1001c6:	8d 90 18 02 00 00    	lea    0x218(%eax),%edx
  1001cc:	81 fa 64 9d 10 00    	cmp    $0x109d64,%edx
    b->next = bcache.head.next;
    b->prev = &bcache.head;
    b->dev = -1;
    bcache.head.next->prev = b;
    bcache.head.next = b;
  1001d2:	a3 74 9d 10 00       	mov    %eax,0x109d74
  initlock(&bcache.lock, "bcache");

  // Create linked list of buffers
  bcache.head.prev = &bcache.head;
  bcache.head.next = &bcache.head;
  for(b = bcache.buf; b < bcache.buf+NBUF; b++){
  1001d7:	72 cf                	jb     1001a8 <binit+0x38>
    b->prev = &bcache.head;
    b->dev = -1;
    bcache.head.next->prev = b;
    bcache.head.next = b;
  }
}
  1001d9:	83 c4 1c             	add    $0x1c,%esp
  1001dc:	c3                   	ret    
  1001dd:	8d 76 00             	lea    0x0(%esi),%esi

001001e0 <bread>:
}

// Return a B_BUSY buf with the contents of the indicated disk sector.
struct buf*
bread(uint dev, uint sector)
{
  1001e0:	57                   	push   %edi
  1001e1:	56                   	push   %esi
  1001e2:	53                   	push   %ebx
  1001e3:	83 ec 10             	sub    $0x10,%esp
  1001e6:	8b 74 24 20          	mov    0x20(%esp),%esi
  1001ea:	8b 7c 24 24          	mov    0x24(%esp),%edi
static struct buf*
bget(uint dev, uint sector)
{
  struct buf *b;

  acquire(&bcache.lock);
  1001ee:	c7 04 24 40 88 10 00 	movl   $0x108840,(%esp)
  1001f5:	e8 76 39 00 00       	call   103b70 <acquire>

 loop:
  // Try for cached block.
  for(b = bcache.head.next; b != &bcache.head; b = b->next){
  1001fa:	8b 1d 74 9d 10 00    	mov    0x109d74,%ebx
  100200:	81 fb 64 9d 10 00    	cmp    $0x109d64,%ebx
  100206:	75 13                	jne    10021b <bread+0x3b>
  100208:	eb 36                	jmp    100240 <bread+0x60>
  10020a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  100210:	8b 5b 10             	mov    0x10(%ebx),%ebx
  100213:	81 fb 64 9d 10 00    	cmp    $0x109d64,%ebx
  100219:	74 25                	je     100240 <bread+0x60>
    if(b->dev == dev && b->sector == sector){
  10021b:	3b 73 04             	cmp    0x4(%ebx),%esi
  10021e:	75 f0                	jne    100210 <bread+0x30>
  100220:	3b 7b 08             	cmp    0x8(%ebx),%edi
  100223:	75 eb                	jne    100210 <bread+0x30>
      if(!(b->flags & B_BUSY)){
  100225:	8b 03                	mov    (%ebx),%eax
  100227:	a8 01                	test   $0x1,%al
  100229:	74 63                	je     10028e <bread+0xae>
        b->flags |= B_BUSY;
        release(&bcache.lock);
        return b;
      }
      sleep(b, &bcache.lock);
  10022b:	c7 44 24 04 40 88 10 	movl   $0x108840,0x4(%esp)
  100232:	00 
  100233:	89 1c 24             	mov    %ebx,(%esp)
  100236:	e8 c5 34 00 00       	call   103700 <sleep>
  10023b:	eb bd                	jmp    1001fa <bread+0x1a>
  10023d:	8d 76 00             	lea    0x0(%esi),%esi
      goto loop;
    }
  }

  // Allocate fresh block.
  for(b = bcache.head.prev; b != &bcache.head; b = b->prev){
  100240:	8b 1d 70 9d 10 00    	mov    0x109d70,%ebx
  100246:	81 fb 64 9d 10 00    	cmp    $0x109d64,%ebx
  10024c:	75 0d                	jne    10025b <bread+0x7b>
  10024e:	eb 51                	jmp    1002a1 <bread+0xc1>
  100250:	8b 5b 0c             	mov    0xc(%ebx),%ebx
  100253:	81 fb 64 9d 10 00    	cmp    $0x109d64,%ebx
  100259:	74 46                	je     1002a1 <bread+0xc1>
    if((b->flags & B_BUSY) == 0){
  10025b:	f6 03 01             	testb  $0x1,(%ebx)
  10025e:	75 f0                	jne    100250 <bread+0x70>
      b->dev = dev;
  100260:	89 73 04             	mov    %esi,0x4(%ebx)
      b->sector = sector;
  100263:	89 7b 08             	mov    %edi,0x8(%ebx)
      b->flags = B_BUSY;
  100266:	c7 03 01 00 00 00    	movl   $0x1,(%ebx)
      release(&bcache.lock);
  10026c:	c7 04 24 40 88 10 00 	movl   $0x108840,(%esp)
  100273:	e8 b8 39 00 00       	call   103c30 <release>
bread(uint dev, uint sector)
{
  struct buf *b;

  b = bget(dev, sector);
  if(!(b->flags & B_VALID))
  100278:	f6 03 02             	testb  $0x2,(%ebx)
  10027b:	75 08                	jne    100285 <bread+0xa5>
    iderw(b);
  10027d:	89 1c 24             	mov    %ebx,(%esp)
  100280:	e8 db 1e 00 00       	call   102160 <iderw>
  return b;
}
  100285:	83 c4 10             	add    $0x10,%esp
  100288:	89 d8                	mov    %ebx,%eax
  10028a:	5b                   	pop    %ebx
  10028b:	5e                   	pop    %esi
  10028c:	5f                   	pop    %edi
  10028d:	c3                   	ret    
 loop:
  // Try for cached block.
  for(b = bcache.head.next; b != &bcache.head; b = b->next){
    if(b->dev == dev && b->sector == sector){
      if(!(b->flags & B_BUSY)){
        b->flags |= B_BUSY;
  10028e:	83 c8 01             	or     $0x1,%eax
  100291:	89 03                	mov    %eax,(%ebx)
        release(&bcache.lock);
  100293:	c7 04 24 40 88 10 00 	movl   $0x108840,(%esp)
  10029a:	e8 91 39 00 00       	call   103c30 <release>
  10029f:	eb d7                	jmp    100278 <bread+0x98>
      b->flags = B_BUSY;
      release(&bcache.lock);
      return b;
    }
  }
  panic("bget: no buffers");
  1002a1:	c7 04 24 c7 5c 10 00 	movl   $0x105cc7,(%esp)
  1002a8:	e8 f3 04 00 00       	call   1007a0 <panic>
  1002ad:	8d 76 00             	lea    0x0(%esi),%esi

001002b0 <bwrite>:
}

// Write b's contents to disk.  Must be locked.
void
bwrite(struct buf *b)
{
  1002b0:	83 ec 1c             	sub    $0x1c,%esp
  1002b3:	8b 44 24 20          	mov    0x20(%esp),%eax
  if((b->flags & B_BUSY) == 0)
  1002b7:	8b 10                	mov    (%eax),%edx
  1002b9:	f6 c2 01             	test   $0x1,%dl
  1002bc:	74 11                	je     1002cf <bwrite+0x1f>
    panic("bwrite");
  b->flags |= B_DIRTY;
  1002be:	83 ca 04             	or     $0x4,%edx
  1002c1:	89 10                	mov    %edx,(%eax)
  iderw(b);
  1002c3:	89 44 24 20          	mov    %eax,0x20(%esp)
}
  1002c7:	83 c4 1c             	add    $0x1c,%esp
bwrite(struct buf *b)
{
  if((b->flags & B_BUSY) == 0)
    panic("bwrite");
  b->flags |= B_DIRTY;
  iderw(b);
  1002ca:	e9 91 1e 00 00       	jmp    102160 <iderw>
// Write b's contents to disk.  Must be locked.
void
bwrite(struct buf *b)
{
  if((b->flags & B_BUSY) == 0)
    panic("bwrite");
  1002cf:	c7 04 24 d8 5c 10 00 	movl   $0x105cd8,(%esp)
  1002d6:	e8 c5 04 00 00       	call   1007a0 <panic>
  1002db:	90                   	nop
  1002dc:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

001002e0 <brelse>:
}

// Release the buffer b.
void
brelse(struct buf *b)
{
  1002e0:	53                   	push   %ebx
  1002e1:	83 ec 18             	sub    $0x18,%esp
  1002e4:	8b 5c 24 20          	mov    0x20(%esp),%ebx
  if((b->flags & B_BUSY) == 0)
  1002e8:	f6 03 01             	testb  $0x1,(%ebx)
  1002eb:	74 57                	je     100344 <brelse+0x64>
    panic("brelse");

  acquire(&bcache.lock);
  1002ed:	c7 04 24 40 88 10 00 	movl   $0x108840,(%esp)
  1002f4:	e8 77 38 00 00       	call   103b70 <acquire>

  b->next->prev = b->prev;
  1002f9:	8b 43 10             	mov    0x10(%ebx),%eax
  1002fc:	8b 53 0c             	mov    0xc(%ebx),%edx
  1002ff:	89 50 0c             	mov    %edx,0xc(%eax)
  b->prev->next = b->next;
  100302:	8b 43 0c             	mov    0xc(%ebx),%eax
  100305:	8b 53 10             	mov    0x10(%ebx),%edx
  100308:	89 50 10             	mov    %edx,0x10(%eax)
  b->next = bcache.head.next;
  10030b:	a1 74 9d 10 00       	mov    0x109d74,%eax
  b->prev = &bcache.head;
  100310:	c7 43 0c 64 9d 10 00 	movl   $0x109d64,0xc(%ebx)

  acquire(&bcache.lock);

  b->next->prev = b->prev;
  b->prev->next = b->next;
  b->next = bcache.head.next;
  100317:	89 43 10             	mov    %eax,0x10(%ebx)
  b->prev = &bcache.head;
  bcache.head.next->prev = b;
  10031a:	a1 74 9d 10 00       	mov    0x109d74,%eax
  10031f:	89 58 0c             	mov    %ebx,0xc(%eax)
  bcache.head.next = b;
  100322:	89 1d 74 9d 10 00    	mov    %ebx,0x109d74

  b->flags &= ~B_BUSY;
  100328:	83 23 fe             	andl   $0xfffffffe,(%ebx)
  wakeup(b);
  10032b:	89 1c 24             	mov    %ebx,(%esp)
  10032e:	e8 8d 34 00 00       	call   1037c0 <wakeup>

  release(&bcache.lock);
  100333:	c7 44 24 20 40 88 10 	movl   $0x108840,0x20(%esp)
  10033a:	00 
}
  10033b:	83 c4 18             	add    $0x18,%esp
  10033e:	5b                   	pop    %ebx
  bcache.head.next = b;

  b->flags &= ~B_BUSY;
  wakeup(b);

  release(&bcache.lock);
  10033f:	e9 ec 38 00 00       	jmp    103c30 <release>
// Release the buffer b.
void
brelse(struct buf *b)
{
  if((b->flags & B_BUSY) == 0)
    panic("brelse");
  100344:	c7 04 24 df 5c 10 00 	movl   $0x105cdf,(%esp)
  10034b:	e8 50 04 00 00       	call   1007a0 <panic>

00100350 <consputc>:
  crt[pos] = ' ' | 0x0700;
}

void
consputc(int c)
{
  100350:	57                   	push   %edi
  100351:	56                   	push   %esi
  100352:	89 c6                	mov    %eax,%esi
  100354:	53                   	push   %ebx
  100355:	83 ec 10             	sub    $0x10,%esp
  if(panicked){
  100358:	a1 d8 87 10 00       	mov    0x1087d8,%eax
  10035d:	85 c0                	test   %eax,%eax
  10035f:	74 03                	je     100364 <consputc+0x14>
}

static inline void
cli(void)
{
  asm volatile("cli");
  100361:	fa                   	cli    
  100362:	eb fe                	jmp    100362 <consputc+0x12>
    cli();
    for(;;)
      ;
  }

  uartputc(c);
  100364:	89 34 24             	mov    %esi,(%esp)
  100367:	e8 c4 4d 00 00       	call   105130 <uartputc>
}

static inline void
outb(ushort port, uchar data)
{
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
  10036c:	b9 d4 03 00 00       	mov    $0x3d4,%ecx
  100371:	b8 0e 00 00 00       	mov    $0xe,%eax
  100376:	89 ca                	mov    %ecx,%edx
  100378:	ee                   	out    %al,(%dx)
static inline uchar
inb(ushort port)
{
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
  100379:	bf d5 03 00 00       	mov    $0x3d5,%edi
  10037e:	89 fa                	mov    %edi,%edx
  100380:	ec                   	in     (%dx),%al
{
  int pos;
  
  // Cursor position: col + 80*row.
  outb(CRTPORT, 14);
  pos = inb(CRTPORT+1) << 8;
  100381:	0f b6 d8             	movzbl %al,%ebx
}

static inline void
outb(ushort port, uchar data)
{
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
  100384:	89 ca                	mov    %ecx,%edx
  100386:	c1 e3 08             	shl    $0x8,%ebx
  100389:	b8 0f 00 00 00       	mov    $0xf,%eax
  10038e:	ee                   	out    %al,(%dx)
static inline uchar
inb(ushort port)
{
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
  10038f:	89 fa                	mov    %edi,%edx
  100391:	ec                   	in     (%dx),%al
  outb(CRTPORT, 15);
  pos |= inb(CRTPORT+1);
  100392:	0f b6 c0             	movzbl %al,%eax
  100395:	09 c3                	or     %eax,%ebx

  if(c == '\n')
  100397:	83 fe 0a             	cmp    $0xa,%esi
  10039a:	74 63                	je     1003ff <consputc+0xaf>
    pos += 80 - pos%80;
  else if(c == BACKSPACE){
  10039c:	81 fe 00 01 00 00    	cmp    $0x100,%esi
  1003a2:	0f 84 b8 00 00 00    	je     100460 <consputc+0x110>
    if(pos > 0)
      crt[--pos] = ' ' | 0x0700;
  } else
    crt[pos++] = (c&0xff) | 0x0700;  // black on white
  1003a8:	66 81 e6 ff 00       	and    $0xff,%si
  1003ad:	66 81 ce 00 07       	or     $0x700,%si
  1003b2:	66 89 b4 1b 00 80 0b 	mov    %si,0xb8000(%ebx,%ebx,1)
  1003b9:	00 
  1003ba:	83 c3 01             	add    $0x1,%ebx
  
  if((pos/80) >= 24){  // Scroll up.
  1003bd:	81 fb 7f 07 00 00    	cmp    $0x77f,%ebx
  1003c3:	7f 51                	jg     100416 <consputc+0xc6>
  1003c5:	8d b4 1b 00 80 0b 00 	lea    0xb8000(%ebx,%ebx,1),%esi
}

static inline void
outb(ushort port, uchar data)
{
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
  1003cc:	b9 d4 03 00 00       	mov    $0x3d4,%ecx
  1003d1:	b8 0e 00 00 00       	mov    $0xe,%eax
  1003d6:	89 ca                	mov    %ecx,%edx
  1003d8:	ee                   	out    %al,(%dx)
  1003d9:	bf d5 03 00 00       	mov    $0x3d5,%edi
    pos -= 80;
    memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
  }
  
  outb(CRTPORT, 14);
  outb(CRTPORT+1, pos>>8);
  1003de:	89 d8                	mov    %ebx,%eax
  1003e0:	c1 f8 08             	sar    $0x8,%eax
  1003e3:	89 fa                	mov    %edi,%edx
  1003e5:	ee                   	out    %al,(%dx)
  1003e6:	b8 0f 00 00 00       	mov    $0xf,%eax
  1003eb:	89 ca                	mov    %ecx,%edx
  1003ed:	ee                   	out    %al,(%dx)
  1003ee:	89 d8                	mov    %ebx,%eax
  1003f0:	89 fa                	mov    %edi,%edx
  1003f2:	ee                   	out    %al,(%dx)
  outb(CRTPORT, 15);
  outb(CRTPORT+1, pos);
  crt[pos] = ' ' | 0x0700;
  1003f3:	66 c7 06 20 07       	movw   $0x720,(%esi)
      ;
  }

  uartputc(c);
  cgaputc(c);
}
  1003f8:	83 c4 10             	add    $0x10,%esp
  1003fb:	5b                   	pop    %ebx
  1003fc:	5e                   	pop    %esi
  1003fd:	5f                   	pop    %edi
  1003fe:	c3                   	ret    
  pos = inb(CRTPORT+1) << 8;
  outb(CRTPORT, 15);
  pos |= inb(CRTPORT+1);

  if(c == '\n')
    pos += 80 - pos%80;
  1003ff:	89 d8                	mov    %ebx,%eax
  100401:	ba 67 66 66 66       	mov    $0x66666667,%edx
  100406:	f7 ea                	imul   %edx
  100408:	c1 ea 05             	shr    $0x5,%edx
  10040b:	8d 04 92             	lea    (%edx,%edx,4),%eax
  10040e:	c1 e0 04             	shl    $0x4,%eax
  100411:	8d 58 50             	lea    0x50(%eax),%ebx
  100414:	eb a7                	jmp    1003bd <consputc+0x6d>
      crt[--pos] = ' ' | 0x0700;
  } else
    crt[pos++] = (c&0xff) | 0x0700;  // black on white
  
  if((pos/80) >= 24){  // Scroll up.
    memmove(crt, crt+80, sizeof(crt[0])*23*80);
  100416:	c7 44 24 08 60 0e 00 	movl   $0xe60,0x8(%esp)
  10041d:	00 
    pos -= 80;
  10041e:	8d 7b b0             	lea    -0x50(%ebx),%edi
      crt[--pos] = ' ' | 0x0700;
  } else
    crt[pos++] = (c&0xff) | 0x0700;  // black on white
  
  if((pos/80) >= 24){  // Scroll up.
    memmove(crt, crt+80, sizeof(crt[0])*23*80);
  100421:	c7 44 24 04 a0 80 0b 	movl   $0xb80a0,0x4(%esp)
  100428:	00 
    pos -= 80;
    memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
  100429:	8d b4 3f 00 80 0b 00 	lea    0xb8000(%edi,%edi,1),%esi
      crt[--pos] = ' ' | 0x0700;
  } else
    crt[pos++] = (c&0xff) | 0x0700;  // black on white
  
  if((pos/80) >= 24){  // Scroll up.
    memmove(crt, crt+80, sizeof(crt[0])*23*80);
  100430:	c7 04 24 00 80 0b 00 	movl   $0xb8000,(%esp)
  100437:	e8 c4 38 00 00       	call   103d00 <memmove>
    pos -= 80;
    memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
  10043c:	b8 d0 07 00 00       	mov    $0x7d0,%eax
  100441:	29 d8                	sub    %ebx,%eax
  } else
    crt[pos++] = (c&0xff) | 0x0700;  // black on white
  
  if((pos/80) >= 24){  // Scroll up.
    memmove(crt, crt+80, sizeof(crt[0])*23*80);
    pos -= 80;
  100443:	89 fb                	mov    %edi,%ebx
    memset(crt+pos, 0, sizeof(crt[0])*(24*80 - pos));
  100445:	01 c0                	add    %eax,%eax
  100447:	89 44 24 08          	mov    %eax,0x8(%esp)
  10044b:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  100452:	00 
  100453:	89 34 24             	mov    %esi,(%esp)
  100456:	e8 25 38 00 00       	call   103c80 <memset>
  10045b:	e9 6c ff ff ff       	jmp    1003cc <consputc+0x7c>
  pos |= inb(CRTPORT+1);

  if(c == '\n')
    pos += 80 - pos%80;
  else if(c == BACKSPACE){
    if(pos > 0)
  100460:	85 db                	test   %ebx,%ebx
  100462:	0f 8e 5d ff ff ff    	jle    1003c5 <consputc+0x75>
      crt[--pos] = ' ' | 0x0700;
  100468:	83 eb 01             	sub    $0x1,%ebx
  10046b:	66 c7 84 1b 00 80 0b 	movw   $0x720,0xb8000(%ebx,%ebx,1)
  100472:	00 20 07 
  100475:	e9 43 ff ff ff       	jmp    1003bd <consputc+0x6d>
  10047a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi

00100480 <consolewrite>:
  return target - n;
}

int
consolewrite(struct inode *ip, char *buf, int n)
{
  100480:	55                   	push   %ebp
  100481:	57                   	push   %edi
  100482:	56                   	push   %esi
  100483:	53                   	push   %ebx
  100484:	83 ec 1c             	sub    $0x1c,%esp
  100487:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  10048b:	8b 74 24 38          	mov    0x38(%esp),%esi
  10048f:	8b 7c 24 34          	mov    0x34(%esp),%edi
  int i;

  iunlock(ip);
  100493:	89 2c 24             	mov    %ebp,(%esp)
  100496:	e8 b5 12 00 00       	call   101750 <iunlock>
  acquire(&cons.lock);
  10049b:	c7 04 24 a0 87 10 00 	movl   $0x1087a0,(%esp)
  1004a2:	e8 c9 36 00 00       	call   103b70 <acquire>
  for(i = 0; i < n; i++)
  1004a7:	85 f6                	test   %esi,%esi
  1004a9:	7e 15                	jle    1004c0 <consolewrite+0x40>
  1004ab:	31 db                	xor    %ebx,%ebx
  1004ad:	8d 76 00             	lea    0x0(%esi),%esi
    consputc(buf[i] & 0xff);
  1004b0:	0f b6 04 1f          	movzbl (%edi,%ebx,1),%eax
{
  int i;

  iunlock(ip);
  acquire(&cons.lock);
  for(i = 0; i < n; i++)
  1004b4:	83 c3 01             	add    $0x1,%ebx
    consputc(buf[i] & 0xff);
  1004b7:	e8 94 fe ff ff       	call   100350 <consputc>
{
  int i;

  iunlock(ip);
  acquire(&cons.lock);
  for(i = 0; i < n; i++)
  1004bc:	39 f3                	cmp    %esi,%ebx
  1004be:	75 f0                	jne    1004b0 <consolewrite+0x30>
    consputc(buf[i] & 0xff);
  release(&cons.lock);
  1004c0:	c7 04 24 a0 87 10 00 	movl   $0x1087a0,(%esp)
  1004c7:	e8 64 37 00 00       	call   103c30 <release>
  ilock(ip);
  1004cc:	89 2c 24             	mov    %ebp,(%esp)
  1004cf:	e8 7c 11 00 00       	call   101650 <ilock>

  return n;
}
  1004d4:	83 c4 1c             	add    $0x1c,%esp
  1004d7:	89 f0                	mov    %esi,%eax
  1004d9:	5b                   	pop    %ebx
  1004da:	5e                   	pop    %esi
  1004db:	5f                   	pop    %edi
  1004dc:	5d                   	pop    %ebp
  1004dd:	c3                   	ret    
  1004de:	66 90                	xchg   %ax,%ax

001004e0 <printint>:
	int locking;
} cons;

static void
printint(int xx, int base, int sgn)
{
  1004e0:	56                   	push   %esi
  1004e1:	53                   	push   %ebx
  1004e2:	89 d3                	mov    %edx,%ebx
  1004e4:	83 ec 14             	sub    $0x14,%esp
  static char digits[] = "0123456789abcdef";
  char buf[16];
  int i = 0, neg = 0;
  uint x;

  if(sgn && xx < 0){
  1004e7:	85 c9                	test   %ecx,%ecx
  1004e9:	74 55                	je     100540 <printint+0x60>
  1004eb:	89 c2                	mov    %eax,%edx
  1004ed:	c1 ea 1f             	shr    $0x1f,%edx
  1004f0:	84 d2                	test   %dl,%dl
  1004f2:	74 4c                	je     100540 <printint+0x60>
    neg = 1;
    x = -xx;
  1004f4:	f7 d8                	neg    %eax
  char buf[16];
  int i = 0, neg = 0;
  uint x;

  if(sgn && xx < 0){
    neg = 1;
  1004f6:	be 01 00 00 00       	mov    $0x1,%esi
static void
printint(int xx, int base, int sgn)
{
  static char digits[] = "0123456789abcdef";
  char buf[16];
  int i = 0, neg = 0;
  1004fb:	31 c9                	xor    %ecx,%ecx
  1004fd:	eb 03                	jmp    100502 <printint+0x22>
  1004ff:	90                   	nop
    x = -xx;
  } else
    x = xx;

  do{
    buf[i++] = digits[x % base];
  100500:	89 d1                	mov    %edx,%ecx
  100502:	31 d2                	xor    %edx,%edx
  100504:	f7 f3                	div    %ebx
  100506:	0f b6 92 0e 5d 10 00 	movzbl 0x105d0e(%edx),%edx
  }while((x /= base) != 0);
  10050d:	85 c0                	test   %eax,%eax
    x = -xx;
  } else
    x = xx;

  do{
    buf[i++] = digits[x % base];
  10050f:	88 14 0c             	mov    %dl,(%esp,%ecx,1)
  100512:	8d 51 01             	lea    0x1(%ecx),%edx
  }while((x /= base) != 0);
  100515:	75 e9                	jne    100500 <printint+0x20>
  if(neg)
  100517:	85 f6                	test   %esi,%esi
  100519:	74 07                	je     100522 <printint+0x42>
    buf[i++] = '-';
  10051b:	c6 04 14 2d          	movb   $0x2d,(%esp,%edx,1)
  10051f:	8d 51 02             	lea    0x2(%ecx),%edx

  while(--i >= 0)
  100522:	8d 5a ff             	lea    -0x1(%edx),%ebx
  100525:	8d 76 00             	lea    0x0(%esi),%esi
    consputc(buf[i]);
  100528:	0f be 04 1c          	movsbl (%esp,%ebx,1),%eax
    buf[i++] = digits[x % base];
  }while((x /= base) != 0);
  if(neg)
    buf[i++] = '-';

  while(--i >= 0)
  10052c:	83 eb 01             	sub    $0x1,%ebx
    consputc(buf[i]);
  10052f:	e8 1c fe ff ff       	call   100350 <consputc>
    buf[i++] = digits[x % base];
  }while((x /= base) != 0);
  if(neg)
    buf[i++] = '-';

  while(--i >= 0)
  100534:	83 fb ff             	cmp    $0xffffffff,%ebx
  100537:	75 ef                	jne    100528 <printint+0x48>
    consputc(buf[i]);
}
  100539:	83 c4 14             	add    $0x14,%esp
  10053c:	5b                   	pop    %ebx
  10053d:	5e                   	pop    %esi
  10053e:	c3                   	ret    
  10053f:	90                   	nop
static void
printint(int xx, int base, int sgn)
{
  static char digits[] = "0123456789abcdef";
  char buf[16];
  int i = 0, neg = 0;
  100540:	31 f6                	xor    %esi,%esi
  100542:	eb b7                	jmp    1004fb <printint+0x1b>
  100544:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  10054a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00100550 <consoleread>:
  release(&input.lock);
}

int
consoleread(struct inode *ip, char *dst, int n)
{
  100550:	55                   	push   %ebp
  100551:	57                   	push   %edi
  100552:	56                   	push   %esi
  100553:	53                   	push   %ebx
  100554:	83 ec 2c             	sub    $0x2c,%esp
  100557:	8b 5c 24 48          	mov    0x48(%esp),%ebx
  10055b:	8b 7c 24 40          	mov    0x40(%esp),%edi
  10055f:	8b 74 24 44          	mov    0x44(%esp),%esi
  uint target;
  int c;

  iunlock(ip);
  100563:	89 3c 24             	mov    %edi,(%esp)
  100566:	e8 e5 11 00 00       	call   101750 <iunlock>
  target = n;
  10056b:	89 5c 24 1c          	mov    %ebx,0x1c(%esp)
  acquire(&input.lock);
  10056f:	c7 04 24 80 9f 10 00 	movl   $0x109f80,(%esp)
  100576:	e8 f5 35 00 00       	call   103b70 <acquire>
  while(n > 0){
  10057b:	31 c0                	xor    %eax,%eax
  10057d:	85 db                	test   %ebx,%ebx
  10057f:	7f 28                	jg     1005a9 <consoleread+0x59>
  100581:	eb 65                	jmp    1005e8 <consoleread+0x98>
  100583:	90                   	nop
  100584:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    while(input.r == input.w){
      if(proc->killed){
  100588:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  10058e:	8b 50 24             	mov    0x24(%eax),%edx
  100591:	85 d2                	test   %edx,%edx
  100593:	75 7b                	jne    100610 <consoleread+0xc0>
        release(&input.lock);
        ilock(ip);
        return -1;
      }
      sleep(&input.r, &input.lock);
  100595:	c7 44 24 04 80 9f 10 	movl   $0x109f80,0x4(%esp)
  10059c:	00 
  10059d:	c7 04 24 34 a0 10 00 	movl   $0x10a034,(%esp)
  1005a4:	e8 57 31 00 00       	call   103700 <sleep>

  iunlock(ip);
  target = n;
  acquire(&input.lock);
  while(n > 0){
    while(input.r == input.w){
  1005a9:	a1 34 a0 10 00       	mov    0x10a034,%eax
  1005ae:	3b 05 38 a0 10 00    	cmp    0x10a038,%eax
  1005b4:	74 d2                	je     100588 <consoleread+0x38>
        ilock(ip);
        return -1;
      }
      sleep(&input.r, &input.lock);
    }
    c = input.buf[input.r++ % INPUT_BUF];
  1005b6:	89 c2                	mov    %eax,%edx
  1005b8:	83 e2 7f             	and    $0x7f,%edx
  1005bb:	0f b6 8a b4 9f 10 00 	movzbl 0x109fb4(%edx),%ecx
  1005c2:	8d 68 01             	lea    0x1(%eax),%ebp
  1005c5:	89 2d 34 a0 10 00    	mov    %ebp,0x10a034
  1005cb:	0f be d1             	movsbl %cl,%edx
    if(c == C('D')){  // EOF
  1005ce:	83 fa 04             	cmp    $0x4,%edx
  1005d1:	74 5e                	je     100631 <consoleread+0xe1>
        // caller gets a 0-byte result.
        input.r--;
      }
      break;
    }
    *dst++ = c;
  1005d3:	88 0e                	mov    %cl,(%esi)
    --n;
  1005d5:	83 eb 01             	sub    $0x1,%ebx
        // caller gets a 0-byte result.
        input.r--;
      }
      break;
    }
    *dst++ = c;
  1005d8:	83 c6 01             	add    $0x1,%esi
    --n;
    if(c == '\n')
  1005db:	83 fa 0a             	cmp    $0xa,%edx
  1005de:	74 5c                	je     10063c <consoleread+0xec>
  int c;

  iunlock(ip);
  target = n;
  acquire(&input.lock);
  while(n > 0){
  1005e0:	85 db                	test   %ebx,%ebx
  1005e2:	75 c5                	jne    1005a9 <consoleread+0x59>
  1005e4:	8b 44 24 1c          	mov    0x1c(%esp),%eax
    *dst++ = c;
    --n;
    if(c == '\n')
      break;
  }
  release(&input.lock);
  1005e8:	89 44 24 18          	mov    %eax,0x18(%esp)
  1005ec:	c7 04 24 80 9f 10 00 	movl   $0x109f80,(%esp)
  1005f3:	e8 38 36 00 00       	call   103c30 <release>
  ilock(ip);
  1005f8:	89 3c 24             	mov    %edi,(%esp)
  1005fb:	e8 50 10 00 00       	call   101650 <ilock>
  100600:	8b 44 24 18          	mov    0x18(%esp),%eax

  return target - n;
}
  100604:	83 c4 2c             	add    $0x2c,%esp
  100607:	5b                   	pop    %ebx
  100608:	5e                   	pop    %esi
  100609:	5f                   	pop    %edi
  10060a:	5d                   	pop    %ebp
  10060b:	c3                   	ret    
  10060c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  target = n;
  acquire(&input.lock);
  while(n > 0){
    while(input.r == input.w){
      if(proc->killed){
        release(&input.lock);
  100610:	c7 04 24 80 9f 10 00 	movl   $0x109f80,(%esp)
  100617:	e8 14 36 00 00       	call   103c30 <release>
        ilock(ip);
  10061c:	89 3c 24             	mov    %edi,(%esp)
  10061f:	e8 2c 10 00 00       	call   101650 <ilock>
  }
  release(&input.lock);
  ilock(ip);

  return target - n;
}
  100624:	83 c4 2c             	add    $0x2c,%esp
  while(n > 0){
    while(input.r == input.w){
      if(proc->killed){
        release(&input.lock);
        ilock(ip);
        return -1;
  100627:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
  }
  release(&input.lock);
  ilock(ip);

  return target - n;
}
  10062c:	5b                   	pop    %ebx
  10062d:	5e                   	pop    %esi
  10062e:	5f                   	pop    %edi
  10062f:	5d                   	pop    %ebp
  100630:	c3                   	ret    
      }
      sleep(&input.r, &input.lock);
    }
    c = input.buf[input.r++ % INPUT_BUF];
    if(c == C('D')){  // EOF
      if(n < target){
  100631:	39 5c 24 1c          	cmp    %ebx,0x1c(%esp)
  100635:	76 05                	jbe    10063c <consoleread+0xec>
        // Save ^D for next time, to make sure
        // caller gets a 0-byte result.
        input.r--;
  100637:	a3 34 a0 10 00       	mov    %eax,0x10a034
  10063c:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  100640:	29 d8                	sub    %ebx,%eax
  100642:	eb a4                	jmp    1005e8 <consoleread+0x98>
  100644:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  10064a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00100650 <cprintf>:
}

// Print to the console. only understands %d, %x, %p, %s.
void
cprintf(char *fmt, ...)
{
  100650:	55                   	push   %ebp
  100651:	57                   	push   %edi
  100652:	56                   	push   %esi
  100653:	53                   	push   %ebx
  100654:	83 ec 1c             	sub    $0x1c,%esp
  int i, c, state, locking;
  uint *argp;
  char *s;

  locking = cons.locking;
  100657:	8b 3d d4 87 10 00    	mov    0x1087d4,%edi
  if(locking)
  10065d:	85 ff                	test   %edi,%edi
  10065f:	0f 85 13 01 00 00    	jne    100778 <cprintf+0x128>
    acquire(&cons.lock);

  argp = (uint*)(void*)(&fmt + 1);
  state = 0;
  for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
  100665:	8b 54 24 30          	mov    0x30(%esp),%edx
  100669:	0f b6 02             	movzbl (%edx),%eax
  10066c:	85 c0                	test   %eax,%eax
  10066e:	0f 84 84 00 00 00    	je     1006f8 <cprintf+0xa8>
  100674:	8d 74 24 34          	lea    0x34(%esp),%esi
  100678:	31 db                	xor    %ebx,%ebx
  10067a:	eb 38                	jmp    1006b4 <cprintf+0x64>
  10067c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
      continue;
    }
    c = fmt[++i] & 0xff;
    if(c == 0)
      break;
    switch(c){
  100680:	83 fd 25             	cmp    $0x25,%ebp
  100683:	0f 84 a7 00 00 00    	je     100730 <cprintf+0xe0>
  100689:	83 fd 64             	cmp    $0x64,%ebp
  10068c:	0f 84 7e 00 00 00    	je     100710 <cprintf+0xc0>
    case '%':
      consputc('%');
      break;
    default:
      // Print unknown % sequence to draw attention.
      consputc('%');
  100692:	b8 25 00 00 00       	mov    $0x25,%eax
  100697:	e8 b4 fc ff ff       	call   100350 <consputc>
      consputc(c);
  10069c:	89 e8                	mov    %ebp,%eax
  10069e:	66 90                	xchg   %ax,%ax
  1006a0:	e8 ab fc ff ff       	call   100350 <consputc>
  1006a5:	8b 54 24 30          	mov    0x30(%esp),%edx
  if(locking)
    acquire(&cons.lock);

  argp = (uint*)(void*)(&fmt + 1);
  state = 0;
  for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
  1006a9:	83 c3 01             	add    $0x1,%ebx
  1006ac:	0f b6 04 1a          	movzbl (%edx,%ebx,1),%eax
  1006b0:	85 c0                	test   %eax,%eax
  1006b2:	74 44                	je     1006f8 <cprintf+0xa8>
    if(c != '%'){
  1006b4:	83 f8 25             	cmp    $0x25,%eax
  1006b7:	75 e7                	jne    1006a0 <cprintf+0x50>
      consputc(c);
      continue;
    }
    c = fmt[++i] & 0xff;
  1006b9:	83 c3 01             	add    $0x1,%ebx
  1006bc:	0f b6 2c 1a          	movzbl (%edx,%ebx,1),%ebp
    if(c == 0)
  1006c0:	85 ed                	test   %ebp,%ebp
  1006c2:	74 34                	je     1006f8 <cprintf+0xa8>
      break;
    switch(c){
  1006c4:	83 fd 70             	cmp    $0x70,%ebp
  1006c7:	74 0e                	je     1006d7 <cprintf+0x87>
  1006c9:	7e b5                	jle    100680 <cprintf+0x30>
  1006cb:	83 fd 73             	cmp    $0x73,%ebp
  1006ce:	66 90                	xchg   %ax,%ax
  1006d0:	74 76                	je     100748 <cprintf+0xf8>
  1006d2:	83 fd 78             	cmp    $0x78,%ebp
  1006d5:	75 bb                	jne    100692 <cprintf+0x42>
    case 'd':
      printint(*argp++, 10, 1);
      break;
    case 'x':
    case 'p':
      printint(*argp++, 16, 0);
  1006d7:	8b 06                	mov    (%esi),%eax
  1006d9:	31 c9                	xor    %ecx,%ecx
  1006db:	ba 10 00 00 00       	mov    $0x10,%edx
  if(locking)
    acquire(&cons.lock);

  argp = (uint*)(void*)(&fmt + 1);
  state = 0;
  for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
  1006e0:	83 c3 01             	add    $0x1,%ebx
    case 'd':
      printint(*argp++, 10, 1);
      break;
    case 'x':
    case 'p':
      printint(*argp++, 16, 0);
  1006e3:	83 c6 04             	add    $0x4,%esi
  1006e6:	e8 f5 fd ff ff       	call   1004e0 <printint>
  1006eb:	8b 54 24 30          	mov    0x30(%esp),%edx
  if(locking)
    acquire(&cons.lock);

  argp = (uint*)(void*)(&fmt + 1);
  state = 0;
  for(i = 0; (c = fmt[i] & 0xff) != 0; i++){
  1006ef:	0f b6 04 1a          	movzbl (%edx,%ebx,1),%eax
  1006f3:	85 c0                	test   %eax,%eax
  1006f5:	75 bd                	jne    1006b4 <cprintf+0x64>
  1006f7:	90                   	nop
      consputc(c);
      break;
    }
  }

  if(locking)
  1006f8:	85 ff                	test   %edi,%edi
  1006fa:	74 0c                	je     100708 <cprintf+0xb8>
    release(&cons.lock);
  1006fc:	c7 04 24 a0 87 10 00 	movl   $0x1087a0,(%esp)
  100703:	e8 28 35 00 00       	call   103c30 <release>
}
  100708:	83 c4 1c             	add    $0x1c,%esp
  10070b:	5b                   	pop    %ebx
  10070c:	5e                   	pop    %esi
  10070d:	5f                   	pop    %edi
  10070e:	5d                   	pop    %ebp
  10070f:	c3                   	ret    
    c = fmt[++i] & 0xff;
    if(c == 0)
      break;
    switch(c){
    case 'd':
      printint(*argp++, 10, 1);
  100710:	8b 06                	mov    (%esi),%eax
  100712:	ba 0a 00 00 00       	mov    $0xa,%edx
  100717:	b9 01 00 00 00       	mov    $0x1,%ecx
  10071c:	83 c6 04             	add    $0x4,%esi
  10071f:	e8 bc fd ff ff       	call   1004e0 <printint>
  100724:	8b 54 24 30          	mov    0x30(%esp),%edx
      break;
  100728:	e9 7c ff ff ff       	jmp    1006a9 <cprintf+0x59>
  10072d:	8d 76 00             	lea    0x0(%esi),%esi
        s = "(null)";
      for(; *s; s++)
        consputc(*s);
      break;
    case '%':
      consputc('%');
  100730:	b8 25 00 00 00       	mov    $0x25,%eax
  100735:	e8 16 fc ff ff       	call   100350 <consputc>
  10073a:	8b 54 24 30          	mov    0x30(%esp),%edx
      break;
  10073e:	e9 66 ff ff ff       	jmp    1006a9 <cprintf+0x59>
  100743:	90                   	nop
  100744:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    case 'x':
    case 'p':
      printint(*argp++, 16, 0);
      break;
    case 's':
      if((s = (char*)*argp++) == 0)
  100748:	8b 2e                	mov    (%esi),%ebp
  10074a:	83 c6 04             	add    $0x4,%esi
  10074d:	85 ed                	test   %ebp,%ebp
  10074f:	74 3f                	je     100790 <cprintf+0x140>
        s = "(null)";
      for(; *s; s++)
  100751:	0f b6 45 00          	movzbl 0x0(%ebp),%eax
  100755:	84 c0                	test   %al,%al
  100757:	0f 84 4c ff ff ff    	je     1006a9 <cprintf+0x59>
  10075d:	8d 76 00             	lea    0x0(%esi),%esi
        consputc(*s);
  100760:	0f be c0             	movsbl %al,%eax
      printint(*argp++, 16, 0);
      break;
    case 's':
      if((s = (char*)*argp++) == 0)
        s = "(null)";
      for(; *s; s++)
  100763:	83 c5 01             	add    $0x1,%ebp
        consputc(*s);
  100766:	e8 e5 fb ff ff       	call   100350 <consputc>
      printint(*argp++, 16, 0);
      break;
    case 's':
      if((s = (char*)*argp++) == 0)
        s = "(null)";
      for(; *s; s++)
  10076b:	0f b6 45 00          	movzbl 0x0(%ebp),%eax
  10076f:	84 c0                	test   %al,%al
  100771:	75 ed                	jne    100760 <cprintf+0x110>
  100773:	e9 2d ff ff ff       	jmp    1006a5 <cprintf+0x55>
  uint *argp;
  char *s;

  locking = cons.locking;
  if(locking)
    acquire(&cons.lock);
  100778:	c7 04 24 a0 87 10 00 	movl   $0x1087a0,(%esp)
  10077f:	e8 ec 33 00 00       	call   103b70 <acquire>
  100784:	e9 dc fe ff ff       	jmp    100665 <cprintf+0x15>
  100789:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
    case 'p':
      printint(*argp++, 16, 0);
      break;
    case 's':
      if((s = (char*)*argp++) == 0)
        s = "(null)";
  100790:	bd e6 5c 10 00       	mov    $0x105ce6,%ebp
  100795:	eb ba                	jmp    100751 <cprintf+0x101>
  100797:	89 f6                	mov    %esi,%esi
  100799:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

001007a0 <panic>:
    release(&cons.lock);
}

void
panic(char *s)
{
  1007a0:	56                   	push   %esi
  1007a1:	53                   	push   %ebx
  1007a2:	83 ec 44             	sub    $0x44,%esp
}

static inline void
cli(void)
{
  asm volatile("cli");
  1007a5:	fa                   	cli    
  int i;
  uint pcs[10];
  
  cli();
  cons.locking = 0;
  cprintf("cpu%d: panic: ", cpu->id);
  1007a6:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
  cprintf(s);
  cprintf("\n");
  getcallerpcs(&s, pcs);
  1007ac:	8d 5c 24 18          	lea    0x18(%esp),%ebx
{
  int i;
  uint pcs[10];
  
  cli();
  cons.locking = 0;
  1007b0:	c7 05 d4 87 10 00 00 	movl   $0x0,0x1087d4
  1007b7:	00 00 00 
  if(locking)
    release(&cons.lock);
}

void
panic(char *s)
  1007ba:	8d 74 24 40          	lea    0x40(%esp),%esi
  int i;
  uint pcs[10];
  
  cli();
  cons.locking = 0;
  cprintf("cpu%d: panic: ", cpu->id);
  1007be:	0f b6 00             	movzbl (%eax),%eax
  1007c1:	c7 04 24 ed 5c 10 00 	movl   $0x105ced,(%esp)
  1007c8:	89 44 24 04          	mov    %eax,0x4(%esp)
  1007cc:	e8 7f fe ff ff       	call   100650 <cprintf>
  cprintf(s);
  1007d1:	8b 44 24 50          	mov    0x50(%esp),%eax
  1007d5:	89 04 24             	mov    %eax,(%esp)
  1007d8:	e8 73 fe ff ff       	call   100650 <cprintf>
  cprintf("\n");
  1007dd:	c7 04 24 63 61 10 00 	movl   $0x106163,(%esp)
  1007e4:	e8 67 fe ff ff       	call   100650 <cprintf>
  getcallerpcs(&s, pcs);
  1007e9:	8d 44 24 50          	lea    0x50(%esp),%eax
  1007ed:	89 5c 24 04          	mov    %ebx,0x4(%esp)
  1007f1:	89 04 24             	mov    %eax,(%esp)
  1007f4:	e8 d7 32 00 00       	call   103ad0 <getcallerpcs>
  1007f9:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  for(i=0; i<10; i++)
    cprintf(" %p", pcs[i]);
  100800:	8b 03                	mov    (%ebx),%eax
  100802:	83 c3 04             	add    $0x4,%ebx
  100805:	c7 04 24 fc 5c 10 00 	movl   $0x105cfc,(%esp)
  10080c:	89 44 24 04          	mov    %eax,0x4(%esp)
  100810:	e8 3b fe ff ff       	call   100650 <cprintf>
  cons.locking = 0;
  cprintf("cpu%d: panic: ", cpu->id);
  cprintf(s);
  cprintf("\n");
  getcallerpcs(&s, pcs);
  for(i=0; i<10; i++)
  100815:	39 f3                	cmp    %esi,%ebx
  100817:	75 e7                	jne    100800 <panic+0x60>
    cprintf(" %p", pcs[i]);
  panicked = 1; // freeze other CPU
  100819:	c7 05 d8 87 10 00 01 	movl   $0x1,0x1087d8
  100820:	00 00 00 
  100823:	eb fe                	jmp    100823 <panic+0x83>
  100825:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  100829:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00100830 <consoleintr>:

#define C(x)  ((x)-'@')  // Control-x

void
consoleintr(int (*getc)(void))
{
  100830:	56                   	push   %esi
  100831:	53                   	push   %ebx
  100832:	83 ec 14             	sub    $0x14,%esp
  100835:	8b 74 24 20          	mov    0x20(%esp),%esi
  int c;

  acquire(&input.lock);
  100839:	c7 04 24 80 9f 10 00 	movl   $0x109f80,(%esp)
  100840:	e8 2b 33 00 00       	call   103b70 <acquire>
  100845:	8d 76 00             	lea    0x0(%esi),%esi
  while((c = getc()) >= 0){
  100848:	ff d6                	call   *%esi
  10084a:	85 c0                	test   %eax,%eax
  10084c:	89 c3                	mov    %eax,%ebx
  10084e:	0f 88 84 00 00 00    	js     1008d8 <consoleintr+0xa8>
    switch(c){
  100854:	83 fb 10             	cmp    $0x10,%ebx
  100857:	0f 84 cb 00 00 00    	je     100928 <consoleintr+0xf8>
  10085d:	83 fb 15             	cmp    $0x15,%ebx
  100860:	0f 84 ae 00 00 00    	je     100914 <consoleintr+0xe4>
  100866:	83 fb 08             	cmp    $0x8,%ebx
  100869:	0f 84 c9 00 00 00    	je     100938 <consoleintr+0x108>
        input.e--;
        consputc(BACKSPACE);
      }
      break;
    default:
      if(c != 0 && input.e-input.r < INPUT_BUF){
  10086f:	85 db                	test   %ebx,%ebx
  100871:	74 d5                	je     100848 <consoleintr+0x18>
  100873:	a1 3c a0 10 00       	mov    0x10a03c,%eax
  100878:	89 c2                	mov    %eax,%edx
  10087a:	2b 15 34 a0 10 00    	sub    0x10a034,%edx
  100880:	83 fa 7f             	cmp    $0x7f,%edx
  100883:	77 c3                	ja     100848 <consoleintr+0x18>
        input.buf[input.e++ % INPUT_BUF] = c;
  100885:	89 c2                	mov    %eax,%edx
  100887:	83 c0 01             	add    $0x1,%eax
  10088a:	83 e2 7f             	and    $0x7f,%edx
  10088d:	88 9a b4 9f 10 00    	mov    %bl,0x109fb4(%edx)
  100893:	a3 3c a0 10 00       	mov    %eax,0x10a03c
        consputc(c);
  100898:	89 d8                	mov    %ebx,%eax
  10089a:	e8 b1 fa ff ff       	call   100350 <consputc>
        if(c == '\n' || c == C('D') || input.e == input.r+INPUT_BUF){
  10089f:	83 fb 04             	cmp    $0x4,%ebx
  1008a2:	a1 3c a0 10 00       	mov    0x10a03c,%eax
  1008a7:	74 12                	je     1008bb <consoleintr+0x8b>
  1008a9:	83 fb 0a             	cmp    $0xa,%ebx
  1008ac:	74 0d                	je     1008bb <consoleintr+0x8b>
  1008ae:	8b 15 34 a0 10 00    	mov    0x10a034,%edx
  1008b4:	83 ea 80             	sub    $0xffffff80,%edx
  1008b7:	39 d0                	cmp    %edx,%eax
  1008b9:	75 8d                	jne    100848 <consoleintr+0x18>
          input.w = input.e;
  1008bb:	a3 38 a0 10 00       	mov    %eax,0x10a038
          wakeup(&input.r);
  1008c0:	c7 04 24 34 a0 10 00 	movl   $0x10a034,(%esp)
  1008c7:	e8 f4 2e 00 00       	call   1037c0 <wakeup>
consoleintr(int (*getc)(void))
{
  int c;

  acquire(&input.lock);
  while((c = getc()) >= 0){
  1008cc:	ff d6                	call   *%esi
  1008ce:	85 c0                	test   %eax,%eax
  1008d0:	89 c3                	mov    %eax,%ebx
  1008d2:	79 80                	jns    100854 <consoleintr+0x24>
  1008d4:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
        }
      }
      break;
    }
  }
  release(&input.lock);
  1008d8:	c7 44 24 20 80 9f 10 	movl   $0x109f80,0x20(%esp)
  1008df:	00 
}
  1008e0:	83 c4 14             	add    $0x14,%esp
  1008e3:	5b                   	pop    %ebx
  1008e4:	5e                   	pop    %esi
        }
      }
      break;
    }
  }
  release(&input.lock);
  1008e5:	e9 46 33 00 00       	jmp    103c30 <release>
  1008ea:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    case C('P'):  // Process listing.
      procdump();
      break;
    case C('U'):  // Kill line.
      while(input.e != input.w &&
            input.buf[(input.e-1) % INPUT_BUF] != '\n'){
  1008f0:	83 e8 01             	sub    $0x1,%eax
  1008f3:	89 c2                	mov    %eax,%edx
  1008f5:	83 e2 7f             	and    $0x7f,%edx
    switch(c){
    case C('P'):  // Process listing.
      procdump();
      break;
    case C('U'):  // Kill line.
      while(input.e != input.w &&
  1008f8:	80 ba b4 9f 10 00 0a 	cmpb   $0xa,0x109fb4(%edx)
  1008ff:	0f 84 43 ff ff ff    	je     100848 <consoleintr+0x18>
            input.buf[(input.e-1) % INPUT_BUF] != '\n'){
        input.e--;
  100905:	a3 3c a0 10 00       	mov    %eax,0x10a03c
        consputc(BACKSPACE);
  10090a:	b8 00 01 00 00       	mov    $0x100,%eax
  10090f:	e8 3c fa ff ff       	call   100350 <consputc>
    switch(c){
    case C('P'):  // Process listing.
      procdump();
      break;
    case C('U'):  // Kill line.
      while(input.e != input.w &&
  100914:	a1 3c a0 10 00       	mov    0x10a03c,%eax
  100919:	3b 05 38 a0 10 00    	cmp    0x10a038,%eax
  10091f:	75 cf                	jne    1008f0 <consoleintr+0xc0>
  100921:	e9 22 ff ff ff       	jmp    100848 <consoleintr+0x18>
  100926:	66 90                	xchg   %ax,%ax

  acquire(&input.lock);
  while((c = getc()) >= 0){
    switch(c){
    case C('P'):  // Process listing.
      procdump();
  100928:	e8 43 27 00 00       	call   103070 <procdump>
  10092d:	8d 76 00             	lea    0x0(%esi),%esi
      break;
  100930:	e9 13 ff ff ff       	jmp    100848 <consoleintr+0x18>
  100935:	8d 76 00             	lea    0x0(%esi),%esi
        input.e--;
        consputc(BACKSPACE);
      }
      break;
    case C('H'):  // Backspace
      if(input.e != input.w){
  100938:	a1 3c a0 10 00       	mov    0x10a03c,%eax
  10093d:	3b 05 38 a0 10 00    	cmp    0x10a038,%eax
  100943:	0f 84 ff fe ff ff    	je     100848 <consoleintr+0x18>
        input.e--;
  100949:	83 e8 01             	sub    $0x1,%eax
  10094c:	a3 3c a0 10 00       	mov    %eax,0x10a03c
        consputc(BACKSPACE);
  100951:	b8 00 01 00 00       	mov    $0x100,%eax
  100956:	e8 f5 f9 ff ff       	call   100350 <consputc>
  10095b:	e9 e8 fe ff ff       	jmp    100848 <consoleintr+0x18>

00100960 <consoleinit>:
  return n;
}

void
consoleinit(void)
{
  100960:	83 ec 1c             	sub    $0x1c,%esp
  initlock(&cons.lock, "console");
  100963:	c7 44 24 04 00 5d 10 	movl   $0x105d00,0x4(%esp)
  10096a:	00 
  10096b:	c7 04 24 a0 87 10 00 	movl   $0x1087a0,(%esp)
  100972:	e8 39 31 00 00       	call   103ab0 <initlock>
  initlock(&input.lock, "input");
  100977:	c7 44 24 04 08 5d 10 	movl   $0x105d08,0x4(%esp)
  10097e:	00 
  10097f:	c7 04 24 80 9f 10 00 	movl   $0x109f80,(%esp)
  100986:	e8 25 31 00 00       	call   103ab0 <initlock>

  devsw[CONSOLE].write = consolewrite;
  devsw[CONSOLE].read = consoleread;
  cons.locking = 1;

  picenable(IRQ_KBD);
  10098b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
consoleinit(void)
{
  initlock(&cons.lock, "console");
  initlock(&input.lock, "input");

  devsw[CONSOLE].write = consolewrite;
  100992:	c7 05 ec a9 10 00 80 	movl   $0x100480,0x10a9ec
  100999:	04 10 00 
  devsw[CONSOLE].read = consoleread;
  10099c:	c7 05 e8 a9 10 00 50 	movl   $0x100550,0x10a9e8
  1009a3:	05 10 00 
  cons.locking = 1;
  1009a6:	c7 05 d4 87 10 00 01 	movl   $0x1,0x1087d4
  1009ad:	00 00 00 

  picenable(IRQ_KBD);
  1009b0:	e8 3b 21 00 00       	call   102af0 <picenable>
  ioapicenable(IRQ_KBD, 0);
  1009b5:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  1009bc:	00 
  1009bd:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  1009c4:	e8 07 19 00 00       	call   1022d0 <ioapicenable>
}
  1009c9:	83 c4 1c             	add    $0x1c,%esp
  1009cc:	c3                   	ret    
  1009cd:	90                   	nop
  1009ce:	90                   	nop
  1009cf:	90                   	nop

001009d0 <exec>:
#include "x86.h"
#include "elf.h"

int
exec(char *path, char **argv)
{
  1009d0:	55                   	push   %ebp
  1009d1:	57                   	push   %edi
  1009d2:	56                   	push   %esi
  1009d3:	53                   	push   %ebx
  1009d4:	81 ec 9c 00 00 00    	sub    $0x9c,%esp
  struct proghdr ph;

  mem = 0;
  sz = 0;

  if((ip = namei(path)) == 0)
  1009da:	8b 94 24 b0 00 00 00 	mov    0xb0(%esp),%edx
  1009e1:	89 14 24             	mov    %edx,(%esp)
  1009e4:	e8 47 15 00 00       	call   101f30 <namei>
  1009e9:	85 c0                	test   %eax,%eax
  1009eb:	89 c3                	mov    %eax,%ebx
  1009ed:	0f 84 f5 03 00 00    	je     100de8 <exec+0x418>
    return -1;
  ilock(ip);
  1009f3:	89 04 24             	mov    %eax,(%esp)
  1009f6:	e8 55 0c 00 00       	call   101650 <ilock>

  // Check ELF header
  if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf))
  1009fb:	8d 44 24 3c          	lea    0x3c(%esp),%eax
  1009ff:	c7 44 24 0c 34 00 00 	movl   $0x34,0xc(%esp)
  100a06:	00 
  100a07:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
  100a0e:	00 
  100a0f:	89 44 24 04          	mov    %eax,0x4(%esp)
  100a13:	89 1c 24             	mov    %ebx,(%esp)
  100a16:	e8 25 0f 00 00       	call   101940 <readi>
  100a1b:	83 f8 33             	cmp    $0x33,%eax
  100a1e:	0f 86 80 03 00 00    	jbe    100da4 <exec+0x3d4>
    goto bad;
  if(elf.magic != ELF_MAGIC)
  100a24:	81 7c 24 3c 7f 45 4c 	cmpl   $0x464c457f,0x3c(%esp)
  100a2b:	46 
  100a2c:	0f 85 72 03 00 00    	jne    100da4 <exec+0x3d4>
    goto bad;

  // Compute memory size of new process.
  // Program segments.
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
  100a32:	66 83 7c 24 68 00    	cmpw   $0x0,0x68(%esp)
  100a38:	8b 7c 24 58          	mov    0x58(%esp),%edi
  100a3c:	0f 84 9c 03 00 00    	je     100dde <exec+0x40e>
  struct elfhdr elf;
  struct inode *ip;
  struct proghdr ph;

  mem = 0;
  sz = 0;
  100a42:	c7 44 24 1c 00 00 00 	movl   $0x0,0x1c(%esp)
  100a49:	00 
  if(elf.magic != ELF_MAGIC)
    goto bad;

  // Compute memory size of new process.
  // Program segments.
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
  100a4a:	31 ed                	xor    %ebp,%ebp
  100a4c:	8d 74 24 70          	lea    0x70(%esp),%esi
  100a50:	eb 15                	jmp    100a67 <exec+0x97>
  100a52:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  100a58:	0f b7 44 24 68       	movzwl 0x68(%esp),%eax
  100a5d:	83 c5 01             	add    $0x1,%ebp
#include "defs.h"
#include "x86.h"
#include "elf.h"

int
exec(char *path, char **argv)
  100a60:	83 c7 20             	add    $0x20,%edi
  if(elf.magic != ELF_MAGIC)
    goto bad;

  // Compute memory size of new process.
  // Program segments.
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
  100a63:	39 e8                	cmp    %ebp,%eax
  100a65:	7e 4f                	jle    100ab6 <exec+0xe6>
    if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
  100a67:	c7 44 24 0c 20 00 00 	movl   $0x20,0xc(%esp)
  100a6e:	00 
  100a6f:	89 7c 24 08          	mov    %edi,0x8(%esp)
  100a73:	89 74 24 04          	mov    %esi,0x4(%esp)
  100a77:	89 1c 24             	mov    %ebx,(%esp)
  100a7a:	e8 c1 0e 00 00       	call   101940 <readi>
  100a7f:	83 f8 20             	cmp    $0x20,%eax
  100a82:	0f 85 1c 03 00 00    	jne    100da4 <exec+0x3d4>
      goto bad;
    if(ph.type != ELF_PROG_LOAD)
  100a88:	83 7c 24 70 01       	cmpl   $0x1,0x70(%esp)
  100a8d:	75 c9                	jne    100a58 <exec+0x88>
      continue;
    if(ph.memsz < ph.filesz)
  100a8f:	8b 84 24 84 00 00 00 	mov    0x84(%esp),%eax
  100a96:	3b 84 24 80 00 00 00 	cmp    0x80(%esp),%eax
  100a9d:	0f 82 01 03 00 00    	jb     100da4 <exec+0x3d4>
      goto bad;
    sz += ph.memsz;
  100aa3:	01 44 24 1c          	add    %eax,0x1c(%esp)
  if(elf.magic != ELF_MAGIC)
    goto bad;

  // Compute memory size of new process.
  // Program segments.
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
  100aa7:	83 c5 01             	add    $0x1,%ebp
  100aaa:	0f b7 44 24 68       	movzwl 0x68(%esp),%eax
#include "defs.h"
#include "x86.h"
#include "elf.h"

int
exec(char *path, char **argv)
  100aaf:	83 c7 20             	add    $0x20,%edi
  if(elf.magic != ELF_MAGIC)
    goto bad;

  // Compute memory size of new process.
  // Program segments.
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
  100ab2:	39 e8                	cmp    %ebp,%eax
  100ab4:	7f b1                	jg     100a67 <exec+0x97>
  100ab6:	8b 7c 24 1c          	mov    0x1c(%esp),%edi
  100aba:	81 c7 07 20 00 00    	add    $0x2007,%edi
    sz += ph.memsz;
  }
  
  // Arguments.
  arglen = 0;
  for(argc=0; argv[argc]; argc++)
  100ac0:	8b 94 24 b4 00 00 00 	mov    0xb4(%esp),%edx
  100ac7:	8b 02                	mov    (%edx),%eax
  100ac9:	85 c0                	test   %eax,%eax
  100acb:	0f 84 eb 02 00 00    	je     100dbc <exec+0x3ec>
  100ad1:	89 5c 24 1c          	mov    %ebx,0x1c(%esp)
  100ad5:	31 f6                	xor    %esi,%esi
  100ad7:	31 ed                	xor    %ebp,%ebp
  100ad9:	c7 44 24 24 00 00 00 	movl   $0x0,0x24(%esp)
  100ae0:	00 
  100ae1:	89 d3                	mov    %edx,%ebx
  100ae3:	90                   	nop
  100ae4:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    arglen += strlen(argv[argc]) + 1;
  100ae8:	89 04 24             	mov    %eax,(%esp)
    sz += ph.memsz;
  }
  
  // Arguments.
  arglen = 0;
  for(argc=0; argv[argc]; argc++)
  100aeb:	83 c5 01             	add    $0x1,%ebp
    arglen += strlen(argv[argc]) + 1;
  100aee:	e8 7d 33 00 00       	call   103e70 <strlen>
  100af3:	8d 74 30 01          	lea    0x1(%eax,%esi,1),%esi
    sz += ph.memsz;
  }
  
  // Arguments.
  arglen = 0;
  for(argc=0; argv[argc]; argc++)
  100af7:	8b 04 ab             	mov    (%ebx,%ebp,4),%eax
  100afa:	85 c0                	test   %eax,%eax
  100afc:	75 ea                	jne    100ae8 <exec+0x118>
  100afe:	83 c6 03             	add    $0x3,%esi
  100b01:	8b 5c 24 1c          	mov    0x1c(%esp),%ebx
  100b05:	89 74 24 28          	mov    %esi,0x28(%esp)
  100b09:	8d 04 ad 04 00 00 00 	lea    0x4(,%ebp,4),%eax
  100b10:	83 64 24 28 fc       	andl   $0xfffffffc,0x28(%esp)
  100b15:	89 6c 24 2c          	mov    %ebp,0x2c(%esp)
  100b19:	89 6c 24 24          	mov    %ebp,0x24(%esp)
    arglen += strlen(argv[argc]) + 1;
  arglen = (arglen+3) & ~3;
  sz += arglen;
  sz += 4*(argc+1);  // argv data
  100b1d:	03 44 24 28          	add    0x28(%esp),%eax

  // Stack.
  sz += PAGE;
  
  // Allocate program memory.
  sz = (sz+PAGE-1) & ~(PAGE-1);
  100b21:	01 f8                	add    %edi,%eax
  100b23:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  100b28:	89 44 24 20          	mov    %eax,0x20(%esp)
  mem = kalloc(sz);
  100b2c:	89 04 24             	mov    %eax,(%esp)
  100b2f:	e8 4c 19 00 00       	call   102480 <kalloc>
  if(mem == 0)
  100b34:	85 c0                	test   %eax,%eax
  // Stack.
  sz += PAGE;
  
  // Allocate program memory.
  sz = (sz+PAGE-1) & ~(PAGE-1);
  mem = kalloc(sz);
  100b36:	89 44 24 1c          	mov    %eax,0x1c(%esp)
  if(mem == 0)
  100b3a:	0f 84 64 02 00 00    	je     100da4 <exec+0x3d4>
    goto bad;
  memset(mem, 0, sz);
  100b40:	8b 54 24 20          	mov    0x20(%esp),%edx
  100b44:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  100b4b:	00 
  100b4c:	89 04 24             	mov    %eax,(%esp)
  100b4f:	89 54 24 08          	mov    %edx,0x8(%esp)
  100b53:	e8 28 31 00 00       	call   103c80 <memset>

  // Load program into memory.
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
  100b58:	8b 7c 24 58          	mov    0x58(%esp),%edi
  100b5c:	66 83 7c 24 68 00    	cmpw   $0x0,0x68(%esp)
  100b62:	0f 84 d2 00 00 00    	je     100c3a <exec+0x26a>
  100b68:	31 ed                	xor    %ebp,%ebp
  100b6a:	8d 74 24 70          	lea    0x70(%esp),%esi
  100b6e:	eb 13                	jmp    100b83 <exec+0x1b3>
  100b70:	0f b7 44 24 68       	movzwl 0x68(%esp),%eax
  100b75:	83 c5 01             	add    $0x1,%ebp
#include "defs.h"
#include "x86.h"
#include "elf.h"

int
exec(char *path, char **argv)
  100b78:	83 c7 20             	add    $0x20,%edi
  if(mem == 0)
    goto bad;
  memset(mem, 0, sz);

  // Load program into memory.
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
  100b7b:	39 e8                	cmp    %ebp,%eax
  100b7d:	0f 8e b7 00 00 00    	jle    100c3a <exec+0x26a>
    if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
  100b83:	c7 44 24 0c 20 00 00 	movl   $0x20,0xc(%esp)
  100b8a:	00 
  100b8b:	89 7c 24 08          	mov    %edi,0x8(%esp)
  100b8f:	89 74 24 04          	mov    %esi,0x4(%esp)
  100b93:	89 1c 24             	mov    %ebx,(%esp)
  100b96:	e8 a5 0d 00 00       	call   101940 <readi>
  100b9b:	83 f8 20             	cmp    $0x20,%eax
  100b9e:	0f 85 ec 01 00 00    	jne    100d90 <exec+0x3c0>
      goto bad;
    if(ph.type != ELF_PROG_LOAD)
  100ba4:	83 7c 24 70 01       	cmpl   $0x1,0x70(%esp)
  100ba9:	75 c5                	jne    100b70 <exec+0x1a0>
      continue;
    if(ph.va + ph.memsz < ph.va || ph.va + ph.memsz > sz)
  100bab:	8b 84 24 84 00 00 00 	mov    0x84(%esp),%eax
  100bb2:	8b 54 24 78          	mov    0x78(%esp),%edx
  100bb6:	89 c1                	mov    %eax,%ecx
  100bb8:	01 d1                	add    %edx,%ecx
  100bba:	0f 82 d0 01 00 00    	jb     100d90 <exec+0x3c0>
  100bc0:	39 4c 24 20          	cmp    %ecx,0x20(%esp)
  100bc4:	0f 82 c6 01 00 00    	jb     100d90 <exec+0x3c0>
      goto bad;
    if(ph.memsz < ph.filesz)
  100bca:	8b 8c 24 80 00 00 00 	mov    0x80(%esp),%ecx
  100bd1:	39 c8                	cmp    %ecx,%eax
  100bd3:	0f 82 b7 01 00 00    	jb     100d90 <exec+0x3c0>
      goto bad;
    if(readi(ip, mem + ph.va, ph.offset, ph.filesz) != ph.filesz)
  100bd9:	8b 44 24 74          	mov    0x74(%esp),%eax
  100bdd:	03 54 24 1c          	add    0x1c(%esp),%edx
  100be1:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
  100be5:	89 1c 24             	mov    %ebx,(%esp)
  100be8:	89 44 24 08          	mov    %eax,0x8(%esp)
  100bec:	89 54 24 04          	mov    %edx,0x4(%esp)
  100bf0:	e8 4b 0d 00 00       	call   101940 <readi>
  100bf5:	3b 84 24 80 00 00 00 	cmp    0x80(%esp),%eax
  100bfc:	0f 85 8e 01 00 00    	jne    100d90 <exec+0x3c0>
      goto bad;
    memset(mem + ph.va + ph.filesz, 0, ph.memsz - ph.filesz);
  100c02:	8b 94 24 84 00 00 00 	mov    0x84(%esp),%edx
  if(mem == 0)
    goto bad;
  memset(mem, 0, sz);

  // Load program into memory.
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
  100c09:	83 c5 01             	add    $0x1,%ebp
#include "defs.h"
#include "x86.h"
#include "elf.h"

int
exec(char *path, char **argv)
  100c0c:	83 c7 20             	add    $0x20,%edi
      goto bad;
    if(ph.memsz < ph.filesz)
      goto bad;
    if(readi(ip, mem + ph.va, ph.offset, ph.filesz) != ph.filesz)
      goto bad;
    memset(mem + ph.va + ph.filesz, 0, ph.memsz - ph.filesz);
  100c0f:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  100c16:	00 
  100c17:	29 c2                	sub    %eax,%edx
  100c19:	03 44 24 78          	add    0x78(%esp),%eax
  100c1d:	03 44 24 1c          	add    0x1c(%esp),%eax
  100c21:	89 54 24 08          	mov    %edx,0x8(%esp)
  100c25:	89 04 24             	mov    %eax,(%esp)
  100c28:	e8 53 30 00 00       	call   103c80 <memset>
  if(mem == 0)
    goto bad;
  memset(mem, 0, sz);

  // Load program into memory.
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
  100c2d:	0f b7 44 24 68       	movzwl 0x68(%esp),%eax
  100c32:	39 e8                	cmp    %ebp,%eax
  100c34:	0f 8f 49 ff ff ff    	jg     100b83 <exec+0x1b3>
      goto bad;
    if(readi(ip, mem + ph.va, ph.offset, ph.filesz) != ph.filesz)
      goto bad;
    memset(mem + ph.va + ph.filesz, 0, ph.memsz - ph.filesz);
  }
  iunlockput(ip);
  100c3a:	89 1c 24             	mov    %ebx,(%esp)
  100c3d:	e8 ae 0c 00 00       	call   1018f0 <iunlockput>
  
  // Initialize stack.
  sp = sz;
  argp = sz - arglen - 4*(argc+1);
  100c42:	8b 44 24 24          	mov    0x24(%esp),%eax
  100c46:	8b 54 24 20          	mov    0x20(%esp),%edx

  // Copy argv strings and pointers to stack.
  *(uint*)(mem+argp + 4*argc) = 0;  // argv[argc]
  for(i=argc-1; i>=0; i--){
  100c4a:	8b 5c 24 24          	mov    0x24(%esp),%ebx
  }
  iunlockput(ip);
  
  // Initialize stack.
  sp = sz;
  argp = sz - arglen - 4*(argc+1);
  100c4e:	f7 d0                	not    %eax
  100c50:	8d 2c 82             	lea    (%edx,%eax,4),%ebp

  // Copy argv strings and pointers to stack.
  *(uint*)(mem+argp + 4*argc) = 0;  // argv[argc]
  100c53:	8b 54 24 24          	mov    0x24(%esp),%edx
  }
  iunlockput(ip);
  
  // Initialize stack.
  sp = sz;
  argp = sz - arglen - 4*(argc+1);
  100c57:	2b 6c 24 28          	sub    0x28(%esp),%ebp

  // Copy argv strings and pointers to stack.
  *(uint*)(mem+argp + 4*argc) = 0;  // argv[argc]
  for(i=argc-1; i>=0; i--){
  100c5b:	83 eb 01             	sub    $0x1,%ebx
  100c5e:	83 fb ff             	cmp    $0xffffffff,%ebx
  // Initialize stack.
  sp = sz;
  argp = sz - arglen - 4*(argc+1);

  // Copy argv strings and pointers to stack.
  *(uint*)(mem+argp + 4*argc) = 0;  // argv[argc]
  100c61:	8d 44 95 00          	lea    0x0(%ebp,%edx,4),%eax
  100c65:	8b 54 24 1c          	mov    0x1c(%esp),%edx
  100c69:	c7 04 02 00 00 00 00 	movl   $0x0,(%edx,%eax,1)
  for(i=argc-1; i>=0; i--){
  100c70:	74 59                	je     100ccb <exec+0x2fb>
  100c72:	8d 3c 2a             	lea    (%edx,%ebp,1),%edi
  100c75:	8b 74 24 20          	mov    0x20(%esp),%esi
  100c79:	89 6c 24 28          	mov    %ebp,0x28(%esp)
  100c7d:	8b ac 24 b4 00 00 00 	mov    0xb4(%esp),%ebp
  100c84:	89 7c 24 24          	mov    %edi,0x24(%esp)
  100c88:	89 d7                	mov    %edx,%edi
  100c8a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    len = strlen(argv[i]) + 1;
  100c90:	8b 44 9d 00          	mov    0x0(%ebp,%ebx,4),%eax
  100c94:	89 04 24             	mov    %eax,(%esp)
  100c97:	e8 d4 31 00 00       	call   103e70 <strlen>
  100c9c:	83 c0 01             	add    $0x1,%eax
    sp -= len;
  100c9f:	29 c6                	sub    %eax,%esi
    memmove(mem+sp, argv[i], len);
  100ca1:	89 44 24 08          	mov    %eax,0x8(%esp)
  100ca5:	8b 44 9d 00          	mov    0x0(%ebp,%ebx,4),%eax
  100ca9:	89 44 24 04          	mov    %eax,0x4(%esp)
  100cad:	8d 04 37             	lea    (%edi,%esi,1),%eax
  100cb0:	89 04 24             	mov    %eax,(%esp)
  100cb3:	e8 48 30 00 00       	call   103d00 <memmove>
    *(uint*)(mem+argp + 4*i) = sp;  // argv[i]
  100cb8:	8b 54 24 24          	mov    0x24(%esp),%edx
  100cbc:	89 34 9a             	mov    %esi,(%edx,%ebx,4)
  sp = sz;
  argp = sz - arglen - 4*(argc+1);

  // Copy argv strings and pointers to stack.
  *(uint*)(mem+argp + 4*argc) = 0;  // argv[argc]
  for(i=argc-1; i>=0; i--){
  100cbf:	83 eb 01             	sub    $0x1,%ebx
  100cc2:	83 fb ff             	cmp    $0xffffffff,%ebx
  100cc5:	75 c9                	jne    100c90 <exec+0x2c0>
  100cc7:	8b 6c 24 28          	mov    0x28(%esp),%ebp
  }

  // Stack frame for main(argc, argv), below arguments.
  sp = argp;
  sp -= 4;
  *(uint*)(mem+sp) = argp;
  100ccb:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  sp -= 4;
  *(uint*)(mem+sp) = argc;
  sp -= 4;
  100ccf:	8d 5d f4             	lea    -0xc(%ebp),%ebx
  // Stack frame for main(argc, argv), below arguments.
  sp = argp;
  sp -= 4;
  *(uint*)(mem+sp) = argp;
  sp -= 4;
  *(uint*)(mem+sp) = argc;
  100cd2:	8b 54 24 2c          	mov    0x2c(%esp),%edx
  }

  // Stack frame for main(argc, argv), below arguments.
  sp = argp;
  sp -= 4;
  *(uint*)(mem+sp) = argp;
  100cd6:	89 6c 28 fc          	mov    %ebp,-0x4(%eax,%ebp,1)
  sp -= 4;
  *(uint*)(mem+sp) = argc;
  100cda:	89 54 28 f8          	mov    %edx,-0x8(%eax,%ebp,1)
  sp -= 4;
  *(uint*)(mem+sp) = 0xffffffff;   // fake return pc
  100cde:	c7 44 28 f4 ff ff ff 	movl   $0xffffffff,-0xc(%eax,%ebp,1)
  100ce5:	ff 

  // Save program name for debugging.
  for(last=s=path; *s; s++)
  100ce6:	8b 84 24 b0 00 00 00 	mov    0xb0(%esp),%eax
  100ced:	0f b6 10             	movzbl (%eax),%edx
  100cf0:	89 c1                	mov    %eax,%ecx
  100cf2:	84 d2                	test   %dl,%dl
  100cf4:	74 27                	je     100d1d <exec+0x34d>
#include "defs.h"
#include "x86.h"
#include "elf.h"

int
exec(char *path, char **argv)
  100cf6:	8d 40 01             	lea    0x1(%eax),%eax
  100cf9:	eb 10                	jmp    100d0b <exec+0x33b>
  100cfb:	90                   	nop
  100cfc:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  *(uint*)(mem+sp) = 0xffffffff;   // fake return pc

  // Save program name for debugging.
  for(last=s=path; *s; s++)
    if(*s == '/')
      last = s+1;
  100d00:	83 c0 01             	add    $0x1,%eax
  *(uint*)(mem+sp) = argc;
  sp -= 4;
  *(uint*)(mem+sp) = 0xffffffff;   // fake return pc

  // Save program name for debugging.
  for(last=s=path; *s; s++)
  100d03:	0f b6 50 ff          	movzbl -0x1(%eax),%edx
  100d07:	84 d2                	test   %dl,%dl
  100d09:	74 12                	je     100d1d <exec+0x34d>
    if(*s == '/')
  100d0b:	80 fa 2f             	cmp    $0x2f,%dl
  100d0e:	75 f0                	jne    100d00 <exec+0x330>
      last = s+1;
  100d10:	89 c1                	mov    %eax,%ecx
  100d12:	83 c0 01             	add    $0x1,%eax
  *(uint*)(mem+sp) = argc;
  sp -= 4;
  *(uint*)(mem+sp) = 0xffffffff;   // fake return pc

  // Save program name for debugging.
  for(last=s=path; *s; s++)
  100d15:	0f b6 50 ff          	movzbl -0x1(%eax),%edx
  100d19:	84 d2                	test   %dl,%dl
  100d1b:	75 ee                	jne    100d0b <exec+0x33b>
    if(*s == '/')
      last = s+1;
  safestrcpy(proc->name, last, sizeof(proc->name));
  100d1d:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  100d23:	89 4c 24 04          	mov    %ecx,0x4(%esp)
  100d27:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
  100d2e:	00 
  100d2f:	83 c0 6c             	add    $0x6c,%eax
  100d32:	89 04 24             	mov    %eax,(%esp)
  100d35:	e8 f6 30 00 00       	call   103e30 <safestrcpy>

  // Commit to the new image.
  kfree(proc->mem, proc->sz);
  100d3a:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  100d40:	8b 50 04             	mov    0x4(%eax),%edx
  100d43:	89 54 24 04          	mov    %edx,0x4(%esp)
  100d47:	8b 00                	mov    (%eax),%eax
  100d49:	89 04 24             	mov    %eax,(%esp)
  100d4c:	e8 bf 15 00 00       	call   102310 <kfree>
  proc->mem = mem;
  100d51:	8b 54 24 1c          	mov    0x1c(%esp),%edx
  100d55:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  100d5b:	89 10                	mov    %edx,(%eax)
  proc->sz = sz;
  100d5d:	8b 54 24 20          	mov    0x20(%esp),%edx
  100d61:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  100d67:	89 50 04             	mov    %edx,0x4(%eax)
  proc->tf->eip = elf.entry;  // main
  100d6a:	8b 50 18             	mov    0x18(%eax),%edx
  100d6d:	8b 4c 24 54          	mov    0x54(%esp),%ecx
  100d71:	89 4a 38             	mov    %ecx,0x38(%edx)
  proc->tf->esp = sp;
  100d74:	8b 40 18             	mov    0x18(%eax),%eax
  100d77:	89 58 44             	mov    %ebx,0x44(%eax)
  usegment();
  100d7a:	e8 91 24 00 00       	call   103210 <usegment>
 bad:
  if(mem)
    kfree(mem, sz);
  iunlockput(ip);
  return -1;
}
  100d7f:	81 c4 9c 00 00 00    	add    $0x9c,%esp
  proc->mem = mem;
  proc->sz = sz;
  proc->tf->eip = elf.entry;  // main
  proc->tf->esp = sp;
  usegment();
  return 0;
  100d85:	31 c0                	xor    %eax,%eax
 bad:
  if(mem)
    kfree(mem, sz);
  iunlockput(ip);
  return -1;
}
  100d87:	5b                   	pop    %ebx
  100d88:	5e                   	pop    %esi
  100d89:	5f                   	pop    %edi
  100d8a:	5d                   	pop    %ebp
  100d8b:	c3                   	ret    
  100d8c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  usegment();
  return 0;

 bad:
  if(mem)
    kfree(mem, sz);
  100d90:	8b 54 24 20          	mov    0x20(%esp),%edx
  100d94:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  100d98:	89 54 24 04          	mov    %edx,0x4(%esp)
  100d9c:	89 04 24             	mov    %eax,(%esp)
  100d9f:	e8 6c 15 00 00       	call   102310 <kfree>
  iunlockput(ip);
  100da4:	89 1c 24             	mov    %ebx,(%esp)
  100da7:	e8 44 0b 00 00       	call   1018f0 <iunlockput>
  return -1;
  100dac:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
  100db1:	81 c4 9c 00 00 00    	add    $0x9c,%esp
  100db7:	5b                   	pop    %ebx
  100db8:	5e                   	pop    %esi
  100db9:	5f                   	pop    %edi
  100dba:	5d                   	pop    %ebp
  100dbb:	c3                   	ret    
    sz += ph.memsz;
  }
  
  // Arguments.
  arglen = 0;
  for(argc=0; argv[argc]; argc++)
  100dbc:	b8 04 00 00 00       	mov    $0x4,%eax
  100dc1:	c7 44 24 28 00 00 00 	movl   $0x0,0x28(%esp)
  100dc8:	00 
  100dc9:	c7 44 24 2c 00 00 00 	movl   $0x0,0x2c(%esp)
  100dd0:	00 
  100dd1:	c7 44 24 24 00 00 00 	movl   $0x0,0x24(%esp)
  100dd8:	00 
  100dd9:	e9 3f fd ff ff       	jmp    100b1d <exec+0x14d>
  if(elf.magic != ELF_MAGIC)
    goto bad;

  // Compute memory size of new process.
  // Program segments.
  for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
  100dde:	bf 07 20 00 00       	mov    $0x2007,%edi
  100de3:	e9 d8 fc ff ff       	jmp    100ac0 <exec+0xf0>

  mem = 0;
  sz = 0;

  if((ip = namei(path)) == 0)
    return -1;
  100de8:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
  100ded:	eb c2                	jmp    100db1 <exec+0x3e1>
  100def:	90                   	nop

00100df0 <fileinit>:
  struct file file[NFILE];
} ftable;

void
fileinit(void)
{
  100df0:	83 ec 1c             	sub    $0x1c,%esp
  initlock(&ftable.lock, "ftable");
  100df3:	c7 44 24 04 1f 5d 10 	movl   $0x105d1f,0x4(%esp)
  100dfa:	00 
  100dfb:	c7 04 24 40 a0 10 00 	movl   $0x10a040,(%esp)
  100e02:	e8 a9 2c 00 00       	call   103ab0 <initlock>
}
  100e07:	83 c4 1c             	add    $0x1c,%esp
  100e0a:	c3                   	ret    
  100e0b:	90                   	nop
  100e0c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

00100e10 <filealloc>:

// Allocate a file structure.
struct file*
filealloc(void)
{
  100e10:	53                   	push   %ebx
  struct file *f;

  acquire(&ftable.lock);
  for(f = ftable.file; f < ftable.file + NFILE; f++){
  100e11:	bb 74 a0 10 00       	mov    $0x10a074,%ebx
}

// Allocate a file structure.
struct file*
filealloc(void)
{
  100e16:	83 ec 18             	sub    $0x18,%esp
  struct file *f;

  acquire(&ftable.lock);
  100e19:	c7 04 24 40 a0 10 00 	movl   $0x10a040,(%esp)
  100e20:	e8 4b 2d 00 00       	call   103b70 <acquire>
  for(f = ftable.file; f < ftable.file + NFILE; f++){
    if(f->ref == 0){
  100e25:	8b 15 78 a0 10 00    	mov    0x10a078,%edx
  100e2b:	85 d2                	test   %edx,%edx
  100e2d:	74 13                	je     100e42 <filealloc+0x32>
  100e2f:	90                   	nop
filealloc(void)
{
  struct file *f;

  acquire(&ftable.lock);
  for(f = ftable.file; f < ftable.file + NFILE; f++){
  100e30:	83 c3 18             	add    $0x18,%ebx
  100e33:	81 fb d4 a9 10 00    	cmp    $0x10a9d4,%ebx
  100e39:	73 25                	jae    100e60 <filealloc+0x50>
    if(f->ref == 0){
  100e3b:	8b 43 04             	mov    0x4(%ebx),%eax
  100e3e:	85 c0                	test   %eax,%eax
  100e40:	75 ee                	jne    100e30 <filealloc+0x20>
      f->ref = 1;
  100e42:	c7 43 04 01 00 00 00 	movl   $0x1,0x4(%ebx)
      release(&ftable.lock);
  100e49:	c7 04 24 40 a0 10 00 	movl   $0x10a040,(%esp)
  100e50:	e8 db 2d 00 00       	call   103c30 <release>
      return f;
    }
  }
  release(&ftable.lock);
  return 0;
}
  100e55:	83 c4 18             	add    $0x18,%esp
  100e58:	89 d8                	mov    %ebx,%eax
  100e5a:	5b                   	pop    %ebx
  100e5b:	c3                   	ret    
  100e5c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
      f->ref = 1;
      release(&ftable.lock);
      return f;
    }
  }
  release(&ftable.lock);
  100e60:	c7 04 24 40 a0 10 00 	movl   $0x10a040,(%esp)
  return 0;
  100e67:	31 db                	xor    %ebx,%ebx
      f->ref = 1;
      release(&ftable.lock);
      return f;
    }
  }
  release(&ftable.lock);
  100e69:	e8 c2 2d 00 00       	call   103c30 <release>
  return 0;
}
  100e6e:	83 c4 18             	add    $0x18,%esp
  100e71:	89 d8                	mov    %ebx,%eax
  100e73:	5b                   	pop    %ebx
  100e74:	c3                   	ret    
  100e75:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  100e79:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00100e80 <filedup>:

// Increment ref count for file f.
struct file*
filedup(struct file *f)
{
  100e80:	53                   	push   %ebx
  100e81:	83 ec 18             	sub    $0x18,%esp
  100e84:	8b 5c 24 20          	mov    0x20(%esp),%ebx
  acquire(&ftable.lock);
  100e88:	c7 04 24 40 a0 10 00 	movl   $0x10a040,(%esp)
  100e8f:	e8 dc 2c 00 00       	call   103b70 <acquire>
  if(f->ref < 1)
  100e94:	8b 43 04             	mov    0x4(%ebx),%eax
  100e97:	85 c0                	test   %eax,%eax
  100e99:	7e 19                	jle    100eb4 <filedup+0x34>
    panic("filedup");
  f->ref++;
  100e9b:	83 c0 01             	add    $0x1,%eax
  100e9e:	89 43 04             	mov    %eax,0x4(%ebx)
  release(&ftable.lock);
  100ea1:	c7 04 24 40 a0 10 00 	movl   $0x10a040,(%esp)
  100ea8:	e8 83 2d 00 00       	call   103c30 <release>
  return f;
}
  100ead:	83 c4 18             	add    $0x18,%esp
  100eb0:	89 d8                	mov    %ebx,%eax
  100eb2:	5b                   	pop    %ebx
  100eb3:	c3                   	ret    
struct file*
filedup(struct file *f)
{
  acquire(&ftable.lock);
  if(f->ref < 1)
    panic("filedup");
  100eb4:	c7 04 24 26 5d 10 00 	movl   $0x105d26,(%esp)
  100ebb:	e8 e0 f8 ff ff       	call   1007a0 <panic>

00100ec0 <fileclose>:
}

// Close file f.  (Decrement ref count, close when reaches 0.)
void
fileclose(struct file *f)
{
  100ec0:	83 ec 3c             	sub    $0x3c,%esp
  100ec3:	89 5c 24 2c          	mov    %ebx,0x2c(%esp)
  100ec7:	8b 5c 24 40          	mov    0x40(%esp),%ebx
  100ecb:	89 74 24 30          	mov    %esi,0x30(%esp)
  100ecf:	89 7c 24 34          	mov    %edi,0x34(%esp)
  100ed3:	89 6c 24 38          	mov    %ebp,0x38(%esp)
  struct file ff;

  acquire(&ftable.lock);
  100ed7:	c7 04 24 40 a0 10 00 	movl   $0x10a040,(%esp)
  100ede:	e8 8d 2c 00 00       	call   103b70 <acquire>
  if(f->ref < 1)
  100ee3:	8b 43 04             	mov    0x4(%ebx),%eax
  100ee6:	85 c0                	test   %eax,%eax
  100ee8:	0f 8e 9d 00 00 00    	jle    100f8b <fileclose+0xcb>
    panic("fileclose");
  if(--f->ref > 0){
  100eee:	83 e8 01             	sub    $0x1,%eax
  100ef1:	85 c0                	test   %eax,%eax
  100ef3:	89 43 04             	mov    %eax,0x4(%ebx)
  100ef6:	74 20                	je     100f18 <fileclose+0x58>
    release(&ftable.lock);
  100ef8:	c7 44 24 40 40 a0 10 	movl   $0x10a040,0x40(%esp)
  100eff:	00 
  
  if(ff.type == FD_PIPE)
    pipeclose(ff.pipe, ff.writable);
  else if(ff.type == FD_INODE)
    iput(ff.ip);
}
  100f00:	8b 5c 24 2c          	mov    0x2c(%esp),%ebx
  100f04:	8b 74 24 30          	mov    0x30(%esp),%esi
  100f08:	8b 7c 24 34          	mov    0x34(%esp),%edi
  100f0c:	8b 6c 24 38          	mov    0x38(%esp),%ebp
  100f10:	83 c4 3c             	add    $0x3c,%esp

  acquire(&ftable.lock);
  if(f->ref < 1)
    panic("fileclose");
  if(--f->ref > 0){
    release(&ftable.lock);
  100f13:	e9 18 2d 00 00       	jmp    103c30 <release>
    return;
  }
  ff = *f;
  100f18:	8b 33                	mov    (%ebx),%esi
  100f1a:	0f b6 43 09          	movzbl 0x9(%ebx),%eax
  f->ref = 0;
  f->type = FD_NONE;
  100f1e:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
    panic("fileclose");
  if(--f->ref > 0){
    release(&ftable.lock);
    return;
  }
  ff = *f;
  100f24:	8b 6b 0c             	mov    0xc(%ebx),%ebp
  100f27:	8b 7b 10             	mov    0x10(%ebx),%edi
  f->ref = 0;
  f->type = FD_NONE;
  release(&ftable.lock);
  100f2a:	c7 04 24 40 a0 10 00 	movl   $0x10a040,(%esp)
    panic("fileclose");
  if(--f->ref > 0){
    release(&ftable.lock);
    return;
  }
  ff = *f;
  100f31:	88 44 24 1f          	mov    %al,0x1f(%esp)
  f->ref = 0;
  f->type = FD_NONE;
  release(&ftable.lock);
  100f35:	e8 f6 2c 00 00       	call   103c30 <release>
  
  if(ff.type == FD_PIPE)
  100f3a:	83 fe 01             	cmp    $0x1,%esi
  100f3d:	74 39                	je     100f78 <fileclose+0xb8>
    pipeclose(ff.pipe, ff.writable);
  else if(ff.type == FD_INODE)
  100f3f:	83 fe 02             	cmp    $0x2,%esi
  100f42:	74 14                	je     100f58 <fileclose+0x98>
    iput(ff.ip);
}
  100f44:	8b 5c 24 2c          	mov    0x2c(%esp),%ebx
  100f48:	8b 74 24 30          	mov    0x30(%esp),%esi
  100f4c:	8b 7c 24 34          	mov    0x34(%esp),%edi
  100f50:	8b 6c 24 38          	mov    0x38(%esp),%ebp
  100f54:	83 c4 3c             	add    $0x3c,%esp
  100f57:	c3                   	ret    
  release(&ftable.lock);
  
  if(ff.type == FD_PIPE)
    pipeclose(ff.pipe, ff.writable);
  else if(ff.type == FD_INODE)
    iput(ff.ip);
  100f58:	89 7c 24 40          	mov    %edi,0x40(%esp)
}
  100f5c:	8b 5c 24 2c          	mov    0x2c(%esp),%ebx
  100f60:	8b 74 24 30          	mov    0x30(%esp),%esi
  100f64:	8b 7c 24 34          	mov    0x34(%esp),%edi
  100f68:	8b 6c 24 38          	mov    0x38(%esp),%ebp
  100f6c:	83 c4 3c             	add    $0x3c,%esp
  release(&ftable.lock);
  
  if(ff.type == FD_PIPE)
    pipeclose(ff.pipe, ff.writable);
  else if(ff.type == FD_INODE)
    iput(ff.ip);
  100f6f:	e9 2c 08 00 00       	jmp    1017a0 <iput>
  100f74:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  f->ref = 0;
  f->type = FD_NONE;
  release(&ftable.lock);
  
  if(ff.type == FD_PIPE)
    pipeclose(ff.pipe, ff.writable);
  100f78:	0f be 44 24 1f       	movsbl 0x1f(%esp),%eax
  100f7d:	89 2c 24             	mov    %ebp,(%esp)
  100f80:	89 44 24 04          	mov    %eax,0x4(%esp)
  100f84:	e8 47 1d 00 00       	call   102cd0 <pipeclose>
  100f89:	eb b9                	jmp    100f44 <fileclose+0x84>
{
  struct file ff;

  acquire(&ftable.lock);
  if(f->ref < 1)
    panic("fileclose");
  100f8b:	c7 04 24 2e 5d 10 00 	movl   $0x105d2e,(%esp)
  100f92:	e8 09 f8 ff ff       	call   1007a0 <panic>
  100f97:	89 f6                	mov    %esi,%esi
  100f99:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00100fa0 <filestat>:
}

// Get metadata about file f.
int
filestat(struct file *f, struct statt *st)
{
  100fa0:	53                   	push   %ebx
    ilock(f->ip);
    stati(f->ip, st);
    iunlock(f->ip);
    return 0;
  }
  return -1;
  100fa1:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}

// Get metadata about file f.
int
filestat(struct file *f, struct statt *st)
{
  100fa6:	83 ec 18             	sub    $0x18,%esp
  100fa9:	8b 5c 24 20          	mov    0x20(%esp),%ebx
  if(f->type == FD_INODE){
  100fad:	83 3b 02             	cmpl   $0x2,(%ebx)
  100fb0:	75 2b                	jne    100fdd <filestat+0x3d>
    ilock(f->ip);
  100fb2:	8b 43 10             	mov    0x10(%ebx),%eax
  100fb5:	89 04 24             	mov    %eax,(%esp)
  100fb8:	e8 93 06 00 00       	call   101650 <ilock>
    stati(f->ip, st);
  100fbd:	8b 44 24 24          	mov    0x24(%esp),%eax
  100fc1:	89 44 24 04          	mov    %eax,0x4(%esp)
  100fc5:	8b 43 10             	mov    0x10(%ebx),%eax
  100fc8:	89 04 24             	mov    %eax,(%esp)
  100fcb:	e8 40 09 00 00       	call   101910 <stati>
    iunlock(f->ip);
  100fd0:	8b 43 10             	mov    0x10(%ebx),%eax
  100fd3:	89 04 24             	mov    %eax,(%esp)
  100fd6:	e8 75 07 00 00       	call   101750 <iunlock>
    return 0;
  100fdb:	31 c0                	xor    %eax,%eax
  }
  return -1;
}
  100fdd:	83 c4 18             	add    $0x18,%esp
  100fe0:	5b                   	pop    %ebx
  100fe1:	c3                   	ret    
  100fe2:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  100fe9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00100ff0 <fileread>:

// Read from file f.  Addr is kernel address.
int
fileread(struct file *f, char *addr, int n)
{
  100ff0:	83 ec 1c             	sub    $0x1c,%esp
  100ff3:	89 5c 24 10          	mov    %ebx,0x10(%esp)
  100ff7:	8b 5c 24 20          	mov    0x20(%esp),%ebx
  100ffb:	89 74 24 14          	mov    %esi,0x14(%esp)
  100fff:	8b 74 24 24          	mov    0x24(%esp),%esi
  101003:	89 7c 24 18          	mov    %edi,0x18(%esp)
  101007:	8b 7c 24 28          	mov    0x28(%esp),%edi
  int r;

  if(f->readable == 0)
  10100b:	80 7b 08 00          	cmpb   $0x0,0x8(%ebx)
  10100f:	74 77                	je     101088 <fileread+0x98>
    return -1;
  if(f->type == FD_PIPE)
  101011:	8b 03                	mov    (%ebx),%eax
  101013:	83 f8 01             	cmp    $0x1,%eax
  101016:	74 50                	je     101068 <fileread+0x78>
    return piperead(f->pipe, addr, n);
  if(f->type == FD_INODE){
  101018:	83 f8 02             	cmp    $0x2,%eax
  10101b:	75 72                	jne    10108f <fileread+0x9f>
    ilock(f->ip);
  10101d:	8b 43 10             	mov    0x10(%ebx),%eax
  101020:	89 04 24             	mov    %eax,(%esp)
  101023:	e8 28 06 00 00       	call   101650 <ilock>
    if((r = readi(f->ip, addr, f->off, n)) > 0)
  101028:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  10102c:	8b 43 14             	mov    0x14(%ebx),%eax
  10102f:	89 74 24 04          	mov    %esi,0x4(%esp)
  101033:	89 44 24 08          	mov    %eax,0x8(%esp)
  101037:	8b 43 10             	mov    0x10(%ebx),%eax
  10103a:	89 04 24             	mov    %eax,(%esp)
  10103d:	e8 fe 08 00 00       	call   101940 <readi>
  101042:	85 c0                	test   %eax,%eax
  101044:	89 c6                	mov    %eax,%esi
  101046:	7e 03                	jle    10104b <fileread+0x5b>
      f->off += r;
  101048:	01 43 14             	add    %eax,0x14(%ebx)
    iunlock(f->ip);
  10104b:	8b 43 10             	mov    0x10(%ebx),%eax
  10104e:	89 04 24             	mov    %eax,(%esp)
  101051:	e8 fa 06 00 00       	call   101750 <iunlock>
    return r;
  }
  panic("fileread");
}
  101056:	89 f0                	mov    %esi,%eax
  101058:	8b 5c 24 10          	mov    0x10(%esp),%ebx
  10105c:	8b 74 24 14          	mov    0x14(%esp),%esi
  101060:	8b 7c 24 18          	mov    0x18(%esp),%edi
  101064:	83 c4 1c             	add    $0x1c,%esp
  101067:	c3                   	ret    
  int r;

  if(f->readable == 0)
    return -1;
  if(f->type == FD_PIPE)
    return piperead(f->pipe, addr, n);
  101068:	8b 43 0c             	mov    0xc(%ebx),%eax
      f->off += r;
    iunlock(f->ip);
    return r;
  }
  panic("fileread");
}
  10106b:	8b 74 24 14          	mov    0x14(%esp),%esi
  10106f:	8b 5c 24 10          	mov    0x10(%esp),%ebx
  101073:	8b 7c 24 18          	mov    0x18(%esp),%edi
  int r;

  if(f->readable == 0)
    return -1;
  if(f->type == FD_PIPE)
    return piperead(f->pipe, addr, n);
  101077:	89 44 24 20          	mov    %eax,0x20(%esp)
      f->off += r;
    iunlock(f->ip);
    return r;
  }
  panic("fileread");
}
  10107b:	83 c4 1c             	add    $0x1c,%esp
  int r;

  if(f->readable == 0)
    return -1;
  if(f->type == FD_PIPE)
    return piperead(f->pipe, addr, n);
  10107e:	e9 ed 1d 00 00       	jmp    102e70 <piperead>
  101083:	90                   	nop
  101084:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
fileread(struct file *f, char *addr, int n)
{
  int r;

  if(f->readable == 0)
    return -1;
  101088:	be ff ff ff ff       	mov    $0xffffffff,%esi
  10108d:	eb c7                	jmp    101056 <fileread+0x66>
    if((r = readi(f->ip, addr, f->off, n)) > 0)
      f->off += r;
    iunlock(f->ip);
    return r;
  }
  panic("fileread");
  10108f:	c7 04 24 38 5d 10 00 	movl   $0x105d38,(%esp)
  101096:	e8 05 f7 ff ff       	call   1007a0 <panic>
  10109b:	90                   	nop
  10109c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

001010a0 <filewrite>:
}

// Write to file f.  Addr is kernel address.
int
filewrite(struct file *f, char *addr, int n)
{
  1010a0:	83 ec 1c             	sub    $0x1c,%esp
  1010a3:	89 5c 24 10          	mov    %ebx,0x10(%esp)
  1010a7:	8b 5c 24 20          	mov    0x20(%esp),%ebx
  1010ab:	89 74 24 14          	mov    %esi,0x14(%esp)
  1010af:	8b 74 24 24          	mov    0x24(%esp),%esi
  1010b3:	89 7c 24 18          	mov    %edi,0x18(%esp)
  1010b7:	8b 7c 24 28          	mov    0x28(%esp),%edi
  int r;

  if(f->writable == 0)
  1010bb:	80 7b 09 00          	cmpb   $0x0,0x9(%ebx)
  1010bf:	74 77                	je     101138 <filewrite+0x98>
    return -1;
  if(f->type == FD_PIPE)
  1010c1:	8b 03                	mov    (%ebx),%eax
  1010c3:	83 f8 01             	cmp    $0x1,%eax
  1010c6:	74 50                	je     101118 <filewrite+0x78>
    return pipewrite(f->pipe, addr, n);
  if(f->type == FD_INODE){
  1010c8:	83 f8 02             	cmp    $0x2,%eax
  1010cb:	75 72                	jne    10113f <filewrite+0x9f>
    ilock(f->ip);
  1010cd:	8b 43 10             	mov    0x10(%ebx),%eax
  1010d0:	89 04 24             	mov    %eax,(%esp)
  1010d3:	e8 78 05 00 00       	call   101650 <ilock>
    if((r = writei(f->ip, addr, f->off, n)) > 0)
  1010d8:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  1010dc:	8b 43 14             	mov    0x14(%ebx),%eax
  1010df:	89 74 24 04          	mov    %esi,0x4(%esp)
  1010e3:	89 44 24 08          	mov    %eax,0x8(%esp)
  1010e7:	8b 43 10             	mov    0x10(%ebx),%eax
  1010ea:	89 04 24             	mov    %eax,(%esp)
  1010ed:	e8 5e 09 00 00       	call   101a50 <writei>
  1010f2:	85 c0                	test   %eax,%eax
  1010f4:	89 c6                	mov    %eax,%esi
  1010f6:	7e 03                	jle    1010fb <filewrite+0x5b>
      f->off += r;
  1010f8:	01 43 14             	add    %eax,0x14(%ebx)
    iunlock(f->ip);
  1010fb:	8b 43 10             	mov    0x10(%ebx),%eax
  1010fe:	89 04 24             	mov    %eax,(%esp)
  101101:	e8 4a 06 00 00       	call   101750 <iunlock>
    return r;
  }
  panic("filewrite");
}
  101106:	89 f0                	mov    %esi,%eax
  101108:	8b 5c 24 10          	mov    0x10(%esp),%ebx
  10110c:	8b 74 24 14          	mov    0x14(%esp),%esi
  101110:	8b 7c 24 18          	mov    0x18(%esp),%edi
  101114:	83 c4 1c             	add    $0x1c,%esp
  101117:	c3                   	ret    
  int r;

  if(f->writable == 0)
    return -1;
  if(f->type == FD_PIPE)
    return pipewrite(f->pipe, addr, n);
  101118:	8b 43 0c             	mov    0xc(%ebx),%eax
      f->off += r;
    iunlock(f->ip);
    return r;
  }
  panic("filewrite");
}
  10111b:	8b 74 24 14          	mov    0x14(%esp),%esi
  10111f:	8b 5c 24 10          	mov    0x10(%esp),%ebx
  101123:	8b 7c 24 18          	mov    0x18(%esp),%edi
  int r;

  if(f->writable == 0)
    return -1;
  if(f->type == FD_PIPE)
    return pipewrite(f->pipe, addr, n);
  101127:	89 44 24 20          	mov    %eax,0x20(%esp)
      f->off += r;
    iunlock(f->ip);
    return r;
  }
  panic("filewrite");
}
  10112b:	83 c4 1c             	add    $0x1c,%esp
  int r;

  if(f->writable == 0)
    return -1;
  if(f->type == FD_PIPE)
    return pipewrite(f->pipe, addr, n);
  10112e:	e9 4d 1c 00 00       	jmp    102d80 <pipewrite>
  101133:	90                   	nop
  101134:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
filewrite(struct file *f, char *addr, int n)
{
  int r;

  if(f->writable == 0)
    return -1;
  101138:	be ff ff ff ff       	mov    $0xffffffff,%esi
  10113d:	eb c7                	jmp    101106 <filewrite+0x66>
    if((r = writei(f->ip, addr, f->off, n)) > 0)
      f->off += r;
    iunlock(f->ip);
    return r;
  }
  panic("filewrite");
  10113f:	c7 04 24 41 5d 10 00 	movl   $0x105d41,(%esp)
  101146:	e8 55 f6 ff ff       	call   1007a0 <panic>
  10114b:	90                   	nop
  10114c:	90                   	nop
  10114d:	90                   	nop
  10114e:	90                   	nop
  10114f:	90                   	nop

00101150 <iget>:

// Find the inode with number inum on device dev
// and return the in-memory copy.
static struct inode*
iget(uint dev, uint inum)
{
  101150:	57                   	push   %edi
  101151:	89 d7                	mov    %edx,%edi
  101153:	56                   	push   %esi
  struct inode *ip, *empty;

  acquire(&icache.lock);

  // Try for cached inode.
  empty = 0;
  101154:	31 f6                	xor    %esi,%esi

// Find the inode with number inum on device dev
// and return the in-memory copy.
static struct inode*
iget(uint dev, uint inum)
{
  101156:	53                   	push   %ebx
  101157:	89 c3                	mov    %eax,%ebx
  101159:	83 ec 20             	sub    $0x20,%esp
  struct inode *ip, *empty;

  acquire(&icache.lock);
  10115c:	c7 04 24 40 aa 10 00 	movl   $0x10aa40,(%esp)
  101163:	e8 08 2a 00 00       	call   103b70 <acquire>

  // Try for cached inode.
  empty = 0;
  for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
  101168:	b8 74 aa 10 00       	mov    $0x10aa74,%eax
  10116d:	eb 0f                	jmp    10117e <iget+0x2e>
  10116f:	90                   	nop
    if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
      ip->ref++;
      release(&icache.lock);
      return ip;
    }
    if(empty == 0 && ip->ref == 0)    // Remember empty slot.
  101170:	85 f6                	test   %esi,%esi
  101172:	74 3c                	je     1011b0 <iget+0x60>

  acquire(&icache.lock);

  // Try for cached inode.
  empty = 0;
  for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
  101174:	83 c0 50             	add    $0x50,%eax
  101177:	3d 14 ba 10 00       	cmp    $0x10ba14,%eax
  10117c:	73 42                	jae    1011c0 <iget+0x70>
    if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
  10117e:	8b 48 08             	mov    0x8(%eax),%ecx
  101181:	85 c9                	test   %ecx,%ecx
  101183:	7e eb                	jle    101170 <iget+0x20>
  101185:	39 18                	cmp    %ebx,(%eax)
  101187:	75 e7                	jne    101170 <iget+0x20>
  101189:	39 78 04             	cmp    %edi,0x4(%eax)
  10118c:	75 e2                	jne    101170 <iget+0x20>
      ip->ref++;
  10118e:	83 c1 01             	add    $0x1,%ecx
  101191:	89 48 08             	mov    %ecx,0x8(%eax)
      release(&icache.lock);
  101194:	89 44 24 1c          	mov    %eax,0x1c(%esp)
  101198:	c7 04 24 40 aa 10 00 	movl   $0x10aa40,(%esp)
  10119f:	e8 8c 2a 00 00       	call   103c30 <release>
      return ip;
  1011a4:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  ip->ref = 1;
  ip->flags = 0;
  release(&icache.lock);

  return ip;
}
  1011a8:	83 c4 20             	add    $0x20,%esp
  1011ab:	5b                   	pop    %ebx
  1011ac:	5e                   	pop    %esi
  1011ad:	5f                   	pop    %edi
  1011ae:	c3                   	ret    
  1011af:	90                   	nop
    if(ip->ref > 0 && ip->dev == dev && ip->inum == inum){
      ip->ref++;
      release(&icache.lock);
      return ip;
    }
    if(empty == 0 && ip->ref == 0)    // Remember empty slot.
  1011b0:	85 c9                	test   %ecx,%ecx
  1011b2:	75 c0                	jne    101174 <iget+0x24>
  1011b4:	89 c6                	mov    %eax,%esi

  acquire(&icache.lock);

  // Try for cached inode.
  empty = 0;
  for(ip = &icache.inode[0]; ip < &icache.inode[NINODE]; ip++){
  1011b6:	83 c0 50             	add    $0x50,%eax
  1011b9:	3d 14 ba 10 00       	cmp    $0x10ba14,%eax
  1011be:	72 be                	jb     10117e <iget+0x2e>
    if(empty == 0 && ip->ref == 0)    // Remember empty slot.
      empty = ip;
  }

  // Allocate fresh inode.
  if(empty == 0)
  1011c0:	85 f6                	test   %esi,%esi
  1011c2:	74 28                	je     1011ec <iget+0x9c>
    panic("iget: no inodes");

  ip = empty;
  ip->dev = dev;
  1011c4:	89 1e                	mov    %ebx,(%esi)
  ip->inum = inum;
  1011c6:	89 7e 04             	mov    %edi,0x4(%esi)
  ip->ref = 1;
  1011c9:	c7 46 08 01 00 00 00 	movl   $0x1,0x8(%esi)
  ip->flags = 0;
  1011d0:	c7 46 0c 00 00 00 00 	movl   $0x0,0xc(%esi)
  release(&icache.lock);
  1011d7:	c7 04 24 40 aa 10 00 	movl   $0x10aa40,(%esp)
  1011de:	e8 4d 2a 00 00       	call   103c30 <release>

  return ip;
}
  1011e3:	83 c4 20             	add    $0x20,%esp
  ip->inum = inum;
  ip->ref = 1;
  ip->flags = 0;
  release(&icache.lock);

  return ip;
  1011e6:	89 f0                	mov    %esi,%eax
}
  1011e8:	5b                   	pop    %ebx
  1011e9:	5e                   	pop    %esi
  1011ea:	5f                   	pop    %edi
  1011eb:	c3                   	ret    
      empty = ip;
  }

  // Allocate fresh inode.
  if(empty == 0)
    panic("iget: no inodes");
  1011ec:	c7 04 24 4b 5d 10 00 	movl   $0x105d4b,(%esp)
  1011f3:	e8 a8 f5 ff ff       	call   1007a0 <panic>
  1011f8:	90                   	nop
  1011f9:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi

00101200 <readsb>:
static void itrunc(struct inode*);

// Read the super block.
static void
readsb(int dev, struct superblock *sb)
{
  101200:	83 ec 1c             	sub    $0x1c,%esp
  101203:	89 5c 24 14          	mov    %ebx,0x14(%esp)
  101207:	89 74 24 18          	mov    %esi,0x18(%esp)
  10120b:	89 d6                	mov    %edx,%esi
  struct buf *bp;
  
  bp = bread(dev, 1);
  10120d:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
  101214:	00 
  101215:	89 04 24             	mov    %eax,(%esp)
  101218:	e8 c3 ef ff ff       	call   1001e0 <bread>
  memmove(sb, bp->data, sizeof(*sb));
  10121d:	89 34 24             	mov    %esi,(%esp)
  101220:	c7 44 24 08 0c 00 00 	movl   $0xc,0x8(%esp)
  101227:	00 
static void
readsb(int dev, struct superblock *sb)
{
  struct buf *bp;
  
  bp = bread(dev, 1);
  101228:	89 c3                	mov    %eax,%ebx
  memmove(sb, bp->data, sizeof(*sb));
  10122a:	8d 40 18             	lea    0x18(%eax),%eax
  10122d:	89 44 24 04          	mov    %eax,0x4(%esp)
  101231:	e8 ca 2a 00 00       	call   103d00 <memmove>
  brelse(bp);
  101236:	89 1c 24             	mov    %ebx,(%esp)
  101239:	e8 a2 f0 ff ff       	call   1002e0 <brelse>
}
  10123e:	8b 5c 24 14          	mov    0x14(%esp),%ebx
  101242:	8b 74 24 18          	mov    0x18(%esp),%esi
  101246:	83 c4 1c             	add    $0x1c,%esp
  101249:	c3                   	ret    
  10124a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi

00101250 <balloc>:
// Blocks. 

// Allocate a disk block.
static uint
balloc(uint dev)
{
  101250:	55                   	push   %ebp
  101251:	57                   	push   %edi
  101252:	56                   	push   %esi
  101253:	53                   	push   %ebx
  101254:	83 ec 3c             	sub    $0x3c,%esp
  int b, bi, m;
  struct buf *bp;
  struct superblock sb;

  bp = 0;
  readsb(dev, &sb);
  101257:	8d 54 24 24          	lea    0x24(%esp),%edx
// Blocks. 

// Allocate a disk block.
static uint
balloc(uint dev)
{
  10125b:	89 44 24 1c          	mov    %eax,0x1c(%esp)
  int b, bi, m;
  struct buf *bp;
  struct superblock sb;

  bp = 0;
  readsb(dev, &sb);
  10125f:	e8 9c ff ff ff       	call   101200 <readsb>
  for(b = 0; b < sb.size; b += BPB){
  101264:	8b 44 24 24          	mov    0x24(%esp),%eax
  101268:	85 c0                	test   %eax,%eax
  10126a:	0f 84 a6 00 00 00    	je     101316 <balloc+0xc6>
  101270:	c7 44 24 18 00 00 00 	movl   $0x0,0x18(%esp)
  101277:	00 
    bp = bread(dev, BBLOCK(b, sb.ninodes));
    for(bi = 0; bi < BPB; bi++){
      m = 1 << (bi % 8);
  101278:	bb 01 00 00 00       	mov    $0x1,%ebx
  struct superblock sb;

  bp = 0;
  readsb(dev, &sb);
  for(b = 0; b < sb.size; b += BPB){
    bp = bread(dev, BBLOCK(b, sb.ninodes));
  10127d:	8b 44 24 2c          	mov    0x2c(%esp),%eax
    for(bi = 0; bi < BPB; bi++){
  101281:	31 f6                	xor    %esi,%esi
  struct superblock sb;

  bp = 0;
  readsb(dev, &sb);
  for(b = 0; b < sb.size; b += BPB){
    bp = bread(dev, BBLOCK(b, sb.ninodes));
  101283:	8b 54 24 18          	mov    0x18(%esp),%edx
  101287:	c1 e8 03             	shr    $0x3,%eax
  10128a:	c1 fa 0c             	sar    $0xc,%edx
  10128d:	8d 44 10 03          	lea    0x3(%eax,%edx,1),%eax
  101291:	89 44 24 04          	mov    %eax,0x4(%esp)
  101295:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  101299:	89 04 24             	mov    %eax,(%esp)
  10129c:	e8 3f ef ff ff       	call   1001e0 <bread>
  1012a1:	89 c7                	mov    %eax,%edi
  1012a3:	eb 0e                	jmp    1012b3 <balloc+0x63>
  1012a5:	8d 76 00             	lea    0x0(%esi),%esi
    for(bi = 0; bi < BPB; bi++){
  1012a8:	83 c6 01             	add    $0x1,%esi
  1012ab:	81 fe 00 10 00 00    	cmp    $0x1000,%esi
  1012b1:	74 45                	je     1012f8 <balloc+0xa8>
      m = 1 << (bi % 8);
  1012b3:	89 f1                	mov    %esi,%ecx
  1012b5:	89 d8                	mov    %ebx,%eax
  1012b7:	83 e1 07             	and    $0x7,%ecx
  1012ba:	d3 e0                	shl    %cl,%eax
  1012bc:	89 c1                	mov    %eax,%ecx
      if((bp->data[bi/8] & m) == 0){  // Is block free?
  1012be:	89 f0                	mov    %esi,%eax
  1012c0:	c1 f8 03             	sar    $0x3,%eax
  1012c3:	0f b6 54 07 18       	movzbl 0x18(%edi,%eax,1),%edx
  1012c8:	0f b6 ea             	movzbl %dl,%ebp
  1012cb:	85 cd                	test   %ecx,%ebp
  1012cd:	75 d9                	jne    1012a8 <balloc+0x58>
        bp->data[bi/8] |= m;  // Mark block in use on disk.
  1012cf:	09 d1                	or     %edx,%ecx
  1012d1:	88 4c 07 18          	mov    %cl,0x18(%edi,%eax,1)
        bwrite(bp);
  1012d5:	89 3c 24             	mov    %edi,(%esp)
  1012d8:	e8 d3 ef ff ff       	call   1002b0 <bwrite>
        brelse(bp);
  1012dd:	89 3c 24             	mov    %edi,(%esp)
  1012e0:	e8 fb ef ff ff       	call   1002e0 <brelse>
        return b + bi;
  1012e5:	8b 44 24 18          	mov    0x18(%esp),%eax
      }
    }
    brelse(bp);
  }
  panic("balloc: out of blocks");
}
  1012e9:	83 c4 3c             	add    $0x3c,%esp
  1012ec:	5b                   	pop    %ebx
      m = 1 << (bi % 8);
      if((bp->data[bi/8] & m) == 0){  // Is block free?
        bp->data[bi/8] |= m;  // Mark block in use on disk.
        bwrite(bp);
        brelse(bp);
        return b + bi;
  1012ed:	01 f0                	add    %esi,%eax
      }
    }
    brelse(bp);
  }
  panic("balloc: out of blocks");
}
  1012ef:	5e                   	pop    %esi
  1012f0:	5f                   	pop    %edi
  1012f1:	5d                   	pop    %ebp
  1012f2:	c3                   	ret    
  1012f3:	90                   	nop
  1012f4:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
        bwrite(bp);
        brelse(bp);
        return b + bi;
      }
    }
    brelse(bp);
  1012f8:	89 3c 24             	mov    %edi,(%esp)
  1012fb:	e8 e0 ef ff ff       	call   1002e0 <brelse>
  struct buf *bp;
  struct superblock sb;

  bp = 0;
  readsb(dev, &sb);
  for(b = 0; b < sb.size; b += BPB){
  101300:	81 44 24 18 00 10 00 	addl   $0x1000,0x18(%esp)
  101307:	00 
  101308:	8b 44 24 18          	mov    0x18(%esp),%eax
  10130c:	3b 44 24 24          	cmp    0x24(%esp),%eax
  101310:	0f 82 67 ff ff ff    	jb     10127d <balloc+0x2d>
        return b + bi;
      }
    }
    brelse(bp);
  }
  panic("balloc: out of blocks");
  101316:	c7 04 24 5b 5d 10 00 	movl   $0x105d5b,(%esp)
  10131d:	e8 7e f4 ff ff       	call   1007a0 <panic>
  101322:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  101329:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00101330 <bfree>:
}

// Free a disk block.
static void
bfree(int dev, uint b)
{
  101330:	57                   	push   %edi
  101331:	56                   	push   %esi
  101332:	89 c6                	mov    %eax,%esi
  101334:	53                   	push   %ebx
  101335:	89 d3                	mov    %edx,%ebx
  101337:	83 ec 20             	sub    $0x20,%esp
static void
bzero(int dev, int bno)
{
  struct buf *bp;
  
  bp = bread(dev, bno);
  10133a:	89 54 24 04          	mov    %edx,0x4(%esp)
  10133e:	89 04 24             	mov    %eax,(%esp)
  101341:	e8 9a ee ff ff       	call   1001e0 <bread>
  memset(bp->data, 0, BSIZE);
  101346:	c7 44 24 08 00 02 00 	movl   $0x200,0x8(%esp)
  10134d:	00 
  10134e:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  101355:	00 
static void
bzero(int dev, int bno)
{
  struct buf *bp;
  
  bp = bread(dev, bno);
  101356:	89 c7                	mov    %eax,%edi
  memset(bp->data, 0, BSIZE);
  101358:	8d 40 18             	lea    0x18(%eax),%eax
  10135b:	89 04 24             	mov    %eax,(%esp)
  10135e:	e8 1d 29 00 00       	call   103c80 <memset>
  bwrite(bp);
  101363:	89 3c 24             	mov    %edi,(%esp)
  101366:	e8 45 ef ff ff       	call   1002b0 <bwrite>
  brelse(bp);
  10136b:	89 3c 24             	mov    %edi,(%esp)
  10136e:	e8 6d ef ff ff       	call   1002e0 <brelse>
  struct superblock sb;
  int bi, m;

  bzero(dev, b);

  readsb(dev, &sb);
  101373:	89 f0                	mov    %esi,%eax
  101375:	8d 54 24 14          	lea    0x14(%esp),%edx
  101379:	e8 82 fe ff ff       	call   101200 <readsb>
  bp = bread(dev, BBLOCK(b, sb.ninodes));
  10137e:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  101382:	89 da                	mov    %ebx,%edx
  101384:	c1 ea 0c             	shr    $0xc,%edx
  101387:	89 34 24             	mov    %esi,(%esp)
  bi = b % BPB;
  m = 1 << (bi % 8);
  10138a:	be 01 00 00 00       	mov    $0x1,%esi
  int bi, m;

  bzero(dev, b);

  readsb(dev, &sb);
  bp = bread(dev, BBLOCK(b, sb.ninodes));
  10138f:	c1 e8 03             	shr    $0x3,%eax
  101392:	8d 44 10 03          	lea    0x3(%eax,%edx,1),%eax
  101396:	89 44 24 04          	mov    %eax,0x4(%esp)
  10139a:	e8 41 ee ff ff       	call   1001e0 <bread>
  bi = b % BPB;
  10139f:	89 da                	mov    %ebx,%edx
  m = 1 << (bi % 8);
  1013a1:	89 d9                	mov    %ebx,%ecx

  bzero(dev, b);

  readsb(dev, &sb);
  bp = bread(dev, BBLOCK(b, sb.ninodes));
  bi = b % BPB;
  1013a3:	81 e2 ff 0f 00 00    	and    $0xfff,%edx
  m = 1 << (bi % 8);
  1013a9:	83 e1 07             	and    $0x7,%ecx
  if((bp->data[bi/8] & m) == 0)
  1013ac:	c1 fa 03             	sar    $0x3,%edx
  bzero(dev, b);

  readsb(dev, &sb);
  bp = bread(dev, BBLOCK(b, sb.ninodes));
  bi = b % BPB;
  m = 1 << (bi % 8);
  1013af:	d3 e6                	shl    %cl,%esi
  if((bp->data[bi/8] & m) == 0)
  1013b1:	0f b6 4c 10 18       	movzbl 0x18(%eax,%edx,1),%ecx
  int bi, m;

  bzero(dev, b);

  readsb(dev, &sb);
  bp = bread(dev, BBLOCK(b, sb.ninodes));
  1013b6:	89 c7                	mov    %eax,%edi
  bi = b % BPB;
  m = 1 << (bi % 8);
  if((bp->data[bi/8] & m) == 0)
  1013b8:	0f b6 c1             	movzbl %cl,%eax
  1013bb:	85 f0                	test   %esi,%eax
  1013bd:	74 21                	je     1013e0 <bfree+0xb0>
    panic("freeing free block");
  bp->data[bi/8] &= ~m;  // Mark block free on disk.
  1013bf:	89 f0                	mov    %esi,%eax
  1013c1:	f7 d0                	not    %eax
  1013c3:	21 c8                	and    %ecx,%eax
  1013c5:	88 44 17 18          	mov    %al,0x18(%edi,%edx,1)
  bwrite(bp);
  1013c9:	89 3c 24             	mov    %edi,(%esp)
  1013cc:	e8 df ee ff ff       	call   1002b0 <bwrite>
  brelse(bp);
  1013d1:	89 3c 24             	mov    %edi,(%esp)
  1013d4:	e8 07 ef ff ff       	call   1002e0 <brelse>
}
  1013d9:	83 c4 20             	add    $0x20,%esp
  1013dc:	5b                   	pop    %ebx
  1013dd:	5e                   	pop    %esi
  1013de:	5f                   	pop    %edi
  1013df:	c3                   	ret    
  readsb(dev, &sb);
  bp = bread(dev, BBLOCK(b, sb.ninodes));
  bi = b % BPB;
  m = 1 << (bi % 8);
  if((bp->data[bi/8] & m) == 0)
    panic("freeing free block");
  1013e0:	c7 04 24 71 5d 10 00 	movl   $0x105d71,(%esp)
  1013e7:	e8 b4 f3 ff ff       	call   1007a0 <panic>
  1013ec:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

001013f0 <bmap>:

// Return the disk block address of the nth block in inode ip.
// If there is no such block, bmap allocates one.
static uint
bmap(struct inode *ip, uint bn)
{
  1013f0:	83 ec 2c             	sub    $0x2c,%esp
  uint addr, *a;
  struct buf *bp;

  if(bn < NDIRECT){
  1013f3:	83 fa 0b             	cmp    $0xb,%edx

// Return the disk block address of the nth block in inode ip.
// If there is no such block, bmap allocates one.
static uint
bmap(struct inode *ip, uint bn)
{
  1013f6:	89 5c 24 1c          	mov    %ebx,0x1c(%esp)
  1013fa:	89 c3                	mov    %eax,%ebx
  1013fc:	89 74 24 20          	mov    %esi,0x20(%esp)
  101400:	89 7c 24 24          	mov    %edi,0x24(%esp)
  101404:	89 6c 24 28          	mov    %ebp,0x28(%esp)
  uint addr, *a;
  struct buf *bp;

  if(bn < NDIRECT){
  101408:	77 26                	ja     101430 <bmap+0x40>
    if((addr = ip->addrs[bn]) == 0)
  10140a:	8d 7a 04             	lea    0x4(%edx),%edi
  10140d:	8b 6c b8 0c          	mov    0xc(%eax,%edi,4),%ebp
  101411:	85 ed                	test   %ebp,%ebp
  101413:	74 63                	je     101478 <bmap+0x88>
    brelse(bp);
    return addr;
  }

  panic("bmap: out of range");
}
  101415:	89 e8                	mov    %ebp,%eax
  101417:	8b 5c 24 1c          	mov    0x1c(%esp),%ebx
  10141b:	8b 74 24 20          	mov    0x20(%esp),%esi
  10141f:	8b 7c 24 24          	mov    0x24(%esp),%edi
  101423:	8b 6c 24 28          	mov    0x28(%esp),%ebp
  101427:	83 c4 2c             	add    $0x2c,%esp
  10142a:	c3                   	ret    
  10142b:	90                   	nop
  10142c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  if(bn < NDIRECT){
    if((addr = ip->addrs[bn]) == 0)
      ip->addrs[bn] = addr = balloc(ip->dev);
    return addr;
  }
  bn -= NDIRECT;
  101430:	8d 7a f4             	lea    -0xc(%edx),%edi

  if(bn < NINDIRECT){
  101433:	83 ff 7f             	cmp    $0x7f,%edi
  101436:	77 5c                	ja     101494 <bmap+0xa4>
    // Load indirect block, allocating if necessary.
    if((addr = ip->addrs[NDIRECT]) == 0)
  101438:	8b 40 4c             	mov    0x4c(%eax),%eax
  10143b:	85 c0                	test   %eax,%eax
  10143d:	74 49                	je     101488 <bmap+0x98>
      ip->addrs[NDIRECT] = addr = balloc(ip->dev);
    bp = bread(ip->dev, addr);
  10143f:	89 44 24 04          	mov    %eax,0x4(%esp)
  101443:	8b 03                	mov    (%ebx),%eax
  101445:	89 04 24             	mov    %eax,(%esp)
  101448:	e8 93 ed ff ff       	call   1001e0 <bread>
    a = (uint*)bp->data;
    if((addr = a[bn]) == 0){
  10144d:	8d 7c b8 18          	lea    0x18(%eax,%edi,4),%edi

  if(bn < NINDIRECT){
    // Load indirect block, allocating if necessary.
    if((addr = ip->addrs[NDIRECT]) == 0)
      ip->addrs[NDIRECT] = addr = balloc(ip->dev);
    bp = bread(ip->dev, addr);
  101451:	89 c6                	mov    %eax,%esi
    a = (uint*)bp->data;
    if((addr = a[bn]) == 0){
  101453:	8b 2f                	mov    (%edi),%ebp
  101455:	85 ed                	test   %ebp,%ebp
  101457:	75 13                	jne    10146c <bmap+0x7c>
      a[bn] = addr = balloc(ip->dev);
  101459:	8b 03                	mov    (%ebx),%eax
  10145b:	e8 f0 fd ff ff       	call   101250 <balloc>
  101460:	89 07                	mov    %eax,(%edi)
  101462:	89 c5                	mov    %eax,%ebp
      bwrite(bp);
  101464:	89 34 24             	mov    %esi,(%esp)
  101467:	e8 44 ee ff ff       	call   1002b0 <bwrite>
    }
    brelse(bp);
  10146c:	89 34 24             	mov    %esi,(%esp)
  10146f:	e8 6c ee ff ff       	call   1002e0 <brelse>
  101474:	eb 9f                	jmp    101415 <bmap+0x25>
  101476:	66 90                	xchg   %ax,%ax
  uint addr, *a;
  struct buf *bp;

  if(bn < NDIRECT){
    if((addr = ip->addrs[bn]) == 0)
      ip->addrs[bn] = addr = balloc(ip->dev);
  101478:	8b 00                	mov    (%eax),%eax
  10147a:	e8 d1 fd ff ff       	call   101250 <balloc>
  10147f:	89 c5                	mov    %eax,%ebp
  101481:	89 44 bb 0c          	mov    %eax,0xc(%ebx,%edi,4)
  101485:	eb 8e                	jmp    101415 <bmap+0x25>
  101487:	90                   	nop
  bn -= NDIRECT;

  if(bn < NINDIRECT){
    // Load indirect block, allocating if necessary.
    if((addr = ip->addrs[NDIRECT]) == 0)
      ip->addrs[NDIRECT] = addr = balloc(ip->dev);
  101488:	8b 03                	mov    (%ebx),%eax
  10148a:	e8 c1 fd ff ff       	call   101250 <balloc>
  10148f:	89 43 4c             	mov    %eax,0x4c(%ebx)
  101492:	eb ab                	jmp    10143f <bmap+0x4f>
    }
    brelse(bp);
    return addr;
  }

  panic("bmap: out of range");
  101494:	c7 04 24 84 5d 10 00 	movl   $0x105d84,(%esp)
  10149b:	e8 00 f3 ff ff       	call   1007a0 <panic>

001014a0 <iinit>:
  struct inode inode[NINODE];
} icache;

void
iinit(void)
{
  1014a0:	83 ec 1c             	sub    $0x1c,%esp
  initlock(&icache.lock, "icache");
  1014a3:	c7 44 24 04 97 5d 10 	movl   $0x105d97,0x4(%esp)
  1014aa:	00 
  1014ab:	c7 04 24 40 aa 10 00 	movl   $0x10aa40,(%esp)
  1014b2:	e8 f9 25 00 00       	call   103ab0 <initlock>
}
  1014b7:	83 c4 1c             	add    $0x1c,%esp
  1014ba:	c3                   	ret    
  1014bb:	90                   	nop
  1014bc:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

001014c0 <ialloc>:
static struct inode* iget(uint dev, uint inum);

// Allocate a new inode with the given type on device dev.
struct inode*
ialloc(uint dev, short type)
{
  1014c0:	55                   	push   %ebp
  1014c1:	57                   	push   %edi
  1014c2:	56                   	push   %esi
  1014c3:	53                   	push   %ebx
  1014c4:	83 ec 3c             	sub    $0x3c,%esp
  1014c7:	0f b7 44 24 54       	movzwl 0x54(%esp),%eax
  int inum;
  struct buf *bp;
  struct dinode *dip;
  struct superblock sb;

  readsb(dev, &sb);
  1014cc:	8d 54 24 24          	lea    0x24(%esp),%edx
static struct inode* iget(uint dev, uint inum);

// Allocate a new inode with the given type on device dev.
struct inode*
ialloc(uint dev, short type)
{
  1014d0:	8b 5c 24 50          	mov    0x50(%esp),%ebx
  1014d4:	66 89 44 24 1e       	mov    %ax,0x1e(%esp)
  int inum;
  struct buf *bp;
  struct dinode *dip;
  struct superblock sb;

  readsb(dev, &sb);
  1014d9:	89 d8                	mov    %ebx,%eax
  1014db:	e8 20 fd ff ff       	call   101200 <readsb>
  for(inum = 1; inum < sb.ninodes; inum++){  // loop over inode blocks
  1014e0:	83 7c 24 2c 01       	cmpl   $0x1,0x2c(%esp)
  1014e5:	0f 86 91 00 00 00    	jbe    10157c <ialloc+0xbc>
  1014eb:	bf 01 00 00 00       	mov    $0x1,%edi
  1014f0:	be 01 00 00 00       	mov    $0x1,%esi
  1014f5:	eb 14                	jmp    10150b <ialloc+0x4b>
  1014f7:	90                   	nop
  1014f8:	83 c6 01             	add    $0x1,%esi
      dip->type = type;
      bwrite(bp);   // mark it allocated on the disk
      brelse(bp);
      return iget(dev, inum);
    }
    brelse(bp);
  1014fb:	89 2c 24             	mov    %ebp,(%esp)
  struct buf *bp;
  struct dinode *dip;
  struct superblock sb;

  readsb(dev, &sb);
  for(inum = 1; inum < sb.ninodes; inum++){  // loop over inode blocks
  1014fe:	89 f7                	mov    %esi,%edi
      dip->type = type;
      bwrite(bp);   // mark it allocated on the disk
      brelse(bp);
      return iget(dev, inum);
    }
    brelse(bp);
  101500:	e8 db ed ff ff       	call   1002e0 <brelse>
  struct buf *bp;
  struct dinode *dip;
  struct superblock sb;

  readsb(dev, &sb);
  for(inum = 1; inum < sb.ninodes; inum++){  // loop over inode blocks
  101505:	3b 74 24 2c          	cmp    0x2c(%esp),%esi
  101509:	73 71                	jae    10157c <ialloc+0xbc>
    bp = bread(dev, IBLOCK(inum));
  10150b:	89 f8                	mov    %edi,%eax
  10150d:	c1 e8 03             	shr    $0x3,%eax
  101510:	83 c0 02             	add    $0x2,%eax
  101513:	89 44 24 04          	mov    %eax,0x4(%esp)
  101517:	89 1c 24             	mov    %ebx,(%esp)
  10151a:	e8 c1 ec ff ff       	call   1001e0 <bread>
  10151f:	89 c5                	mov    %eax,%ebp
    dip = (struct dinode*)bp->data + inum%IPB;
  101521:	89 f8                	mov    %edi,%eax
  101523:	83 e0 07             	and    $0x7,%eax
  101526:	c1 e0 06             	shl    $0x6,%eax
  101529:	8d 54 05 18          	lea    0x18(%ebp,%eax,1),%edx
    if(dip->type == 0){  // a free inode
  10152d:	66 83 3a 00          	cmpw   $0x0,(%edx)
  101531:	75 c5                	jne    1014f8 <ialloc+0x38>
      memset(dip, 0, sizeof(*dip));
  101533:	89 14 24             	mov    %edx,(%esp)
  101536:	89 54 24 18          	mov    %edx,0x18(%esp)
  10153a:	c7 44 24 08 40 00 00 	movl   $0x40,0x8(%esp)
  101541:	00 
  101542:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  101549:	00 
  10154a:	e8 31 27 00 00       	call   103c80 <memset>
      dip->type = type;
  10154f:	8b 54 24 18          	mov    0x18(%esp),%edx
  101553:	0f b7 44 24 1e       	movzwl 0x1e(%esp),%eax
  101558:	66 89 02             	mov    %ax,(%edx)
      bwrite(bp);   // mark it allocated on the disk
  10155b:	89 2c 24             	mov    %ebp,(%esp)
  10155e:	e8 4d ed ff ff       	call   1002b0 <bwrite>
      brelse(bp);
  101563:	89 2c 24             	mov    %ebp,(%esp)
  101566:	e8 75 ed ff ff       	call   1002e0 <brelse>
      return iget(dev, inum);
  10156b:	89 fa                	mov    %edi,%edx
  10156d:	89 d8                	mov    %ebx,%eax
  10156f:	e8 dc fb ff ff       	call   101150 <iget>
    }
    brelse(bp);
  }
  panic("ialloc: no inodes");
}
  101574:	83 c4 3c             	add    $0x3c,%esp
  101577:	5b                   	pop    %ebx
  101578:	5e                   	pop    %esi
  101579:	5f                   	pop    %edi
  10157a:	5d                   	pop    %ebp
  10157b:	c3                   	ret    
      brelse(bp);
      return iget(dev, inum);
    }
    brelse(bp);
  }
  panic("ialloc: no inodes");
  10157c:	c7 04 24 9e 5d 10 00 	movl   $0x105d9e,(%esp)
  101583:	e8 18 f2 ff ff       	call   1007a0 <panic>
  101588:	90                   	nop
  101589:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi

00101590 <iupdate>:
}

// Copy inode, which has changed, from memory to disk.
void
iupdate(struct inode *ip)
{
  101590:	56                   	push   %esi
  101591:	53                   	push   %ebx
  101592:	83 ec 14             	sub    $0x14,%esp
  101595:	8b 5c 24 20          	mov    0x20(%esp),%ebx
  struct buf *bp;
  struct dinode *dip;

  bp = bread(ip->dev, IBLOCK(ip->inum));
  101599:	8b 43 04             	mov    0x4(%ebx),%eax
  10159c:	c1 e8 03             	shr    $0x3,%eax
  10159f:	83 c0 02             	add    $0x2,%eax
  1015a2:	89 44 24 04          	mov    %eax,0x4(%esp)
  1015a6:	8b 03                	mov    (%ebx),%eax
  1015a8:	89 04 24             	mov    %eax,(%esp)
  1015ab:	e8 30 ec ff ff       	call   1001e0 <bread>
  dip = (struct dinode*)bp->data + ip->inum%IPB;
  dip->type = ip->type;
  1015b0:	0f b7 53 10          	movzwl 0x10(%ebx),%edx
iupdate(struct inode *ip)
{
  struct buf *bp;
  struct dinode *dip;

  bp = bread(ip->dev, IBLOCK(ip->inum));
  1015b4:	89 c6                	mov    %eax,%esi
  dip = (struct dinode*)bp->data + ip->inum%IPB;
  1015b6:	8b 43 04             	mov    0x4(%ebx),%eax
  1015b9:	83 e0 07             	and    $0x7,%eax
  1015bc:	c1 e0 06             	shl    $0x6,%eax
  1015bf:	8d 44 06 18          	lea    0x18(%esi,%eax,1),%eax
  dip->type = ip->type;
  1015c3:	66 89 10             	mov    %dx,(%eax)
  dip->major = ip->major;
  1015c6:	0f b7 53 12          	movzwl 0x12(%ebx),%edx
  1015ca:	66 89 50 02          	mov    %dx,0x2(%eax)
  dip->minor = ip->minor;
  1015ce:	0f b7 53 14          	movzwl 0x14(%ebx),%edx
  1015d2:	66 89 50 04          	mov    %dx,0x4(%eax)
  dip->nlink = ip->nlink;
  1015d6:	0f b7 53 16          	movzwl 0x16(%ebx),%edx
  1015da:	66 89 50 06          	mov    %dx,0x6(%eax)
  dip->size = ip->size;
  1015de:	8b 53 18             	mov    0x18(%ebx),%edx
  memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
  1015e1:	83 c3 1c             	add    $0x1c,%ebx
  dip = (struct dinode*)bp->data + ip->inum%IPB;
  dip->type = ip->type;
  dip->major = ip->major;
  dip->minor = ip->minor;
  dip->nlink = ip->nlink;
  dip->size = ip->size;
  1015e4:	89 50 08             	mov    %edx,0x8(%eax)
  memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
  1015e7:	83 c0 0c             	add    $0xc,%eax
  1015ea:	89 5c 24 04          	mov    %ebx,0x4(%esp)
  1015ee:	c7 44 24 08 34 00 00 	movl   $0x34,0x8(%esp)
  1015f5:	00 
  1015f6:	89 04 24             	mov    %eax,(%esp)
  1015f9:	e8 02 27 00 00       	call   103d00 <memmove>
  bwrite(bp);
  1015fe:	89 34 24             	mov    %esi,(%esp)
  101601:	e8 aa ec ff ff       	call   1002b0 <bwrite>
  brelse(bp);
  101606:	89 74 24 20          	mov    %esi,0x20(%esp)
}
  10160a:	83 c4 14             	add    $0x14,%esp
  10160d:	5b                   	pop    %ebx
  10160e:	5e                   	pop    %esi
  dip->minor = ip->minor;
  dip->nlink = ip->nlink;
  dip->size = ip->size;
  memmove(dip->addrs, ip->addrs, sizeof(ip->addrs));
  bwrite(bp);
  brelse(bp);
  10160f:	e9 cc ec ff ff       	jmp    1002e0 <brelse>
  101614:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  10161a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00101620 <idup>:

// Increment reference count for ip.
// Returns ip to enable ip = idup(ip1) idiom.
struct inode*
idup(struct inode *ip)
{
  101620:	53                   	push   %ebx
  101621:	83 ec 18             	sub    $0x18,%esp
  101624:	8b 5c 24 20          	mov    0x20(%esp),%ebx
  acquire(&icache.lock);
  101628:	c7 04 24 40 aa 10 00 	movl   $0x10aa40,(%esp)
  10162f:	e8 3c 25 00 00       	call   103b70 <acquire>
  ip->ref++;
  101634:	83 43 08 01          	addl   $0x1,0x8(%ebx)
  release(&icache.lock);
  101638:	c7 04 24 40 aa 10 00 	movl   $0x10aa40,(%esp)
  10163f:	e8 ec 25 00 00       	call   103c30 <release>
  return ip;
}
  101644:	83 c4 18             	add    $0x18,%esp
  101647:	89 d8                	mov    %ebx,%eax
  101649:	5b                   	pop    %ebx
  10164a:	c3                   	ret    
  10164b:	90                   	nop
  10164c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

00101650 <ilock>:

// Lock the given inode.
void
ilock(struct inode *ip)
{
  101650:	56                   	push   %esi
  101651:	53                   	push   %ebx
  101652:	83 ec 14             	sub    $0x14,%esp
  101655:	8b 5c 24 20          	mov    0x20(%esp),%ebx
  struct buf *bp;
  struct dinode *dip;

  if(ip == 0 || ip->ref < 1)
  101659:	85 db                	test   %ebx,%ebx
  10165b:	0f 84 df 00 00 00    	je     101740 <ilock+0xf0>
  101661:	8b 53 08             	mov    0x8(%ebx),%edx
  101664:	85 d2                	test   %edx,%edx
  101666:	0f 8e d4 00 00 00    	jle    101740 <ilock+0xf0>
    panic("ilock");

  acquire(&icache.lock);
  10166c:	c7 04 24 40 aa 10 00 	movl   $0x10aa40,(%esp)
  101673:	e8 f8 24 00 00       	call   103b70 <acquire>
  while(ip->flags & I_BUSY)
  101678:	8b 43 0c             	mov    0xc(%ebx),%eax
  10167b:	a8 01                	test   $0x1,%al
  10167d:	74 18                	je     101697 <ilock+0x47>
  10167f:	90                   	nop
    sleep(ip, &icache.lock);
  101680:	c7 44 24 04 40 aa 10 	movl   $0x10aa40,0x4(%esp)
  101687:	00 
  101688:	89 1c 24             	mov    %ebx,(%esp)
  10168b:	e8 70 20 00 00       	call   103700 <sleep>

  if(ip == 0 || ip->ref < 1)
    panic("ilock");

  acquire(&icache.lock);
  while(ip->flags & I_BUSY)
  101690:	8b 43 0c             	mov    0xc(%ebx),%eax
  101693:	a8 01                	test   $0x1,%al
  101695:	75 e9                	jne    101680 <ilock+0x30>
    sleep(ip, &icache.lock);
  ip->flags |= I_BUSY;
  101697:	83 c8 01             	or     $0x1,%eax
  10169a:	89 43 0c             	mov    %eax,0xc(%ebx)
  release(&icache.lock);
  10169d:	c7 04 24 40 aa 10 00 	movl   $0x10aa40,(%esp)
  1016a4:	e8 87 25 00 00       	call   103c30 <release>

  if(!(ip->flags & I_VALID)){
  1016a9:	f6 43 0c 02          	testb  $0x2,0xc(%ebx)
  1016ad:	74 09                	je     1016b8 <ilock+0x68>
    brelse(bp);
    ip->flags |= I_VALID;
    if(ip->type == 0)
      panic("ilock: no type");
  }
}
  1016af:	83 c4 14             	add    $0x14,%esp
  1016b2:	5b                   	pop    %ebx
  1016b3:	5e                   	pop    %esi
  1016b4:	c3                   	ret    
  1016b5:	8d 76 00             	lea    0x0(%esi),%esi
    sleep(ip, &icache.lock);
  ip->flags |= I_BUSY;
  release(&icache.lock);

  if(!(ip->flags & I_VALID)){
    bp = bread(ip->dev, IBLOCK(ip->inum));
  1016b8:	8b 43 04             	mov    0x4(%ebx),%eax
  1016bb:	c1 e8 03             	shr    $0x3,%eax
  1016be:	83 c0 02             	add    $0x2,%eax
  1016c1:	89 44 24 04          	mov    %eax,0x4(%esp)
  1016c5:	8b 03                	mov    (%ebx),%eax
  1016c7:	89 04 24             	mov    %eax,(%esp)
  1016ca:	e8 11 eb ff ff       	call   1001e0 <bread>
  1016cf:	89 c6                	mov    %eax,%esi
    dip = (struct dinode*)bp->data + ip->inum%IPB;
  1016d1:	8b 43 04             	mov    0x4(%ebx),%eax
  1016d4:	83 e0 07             	and    $0x7,%eax
  1016d7:	c1 e0 06             	shl    $0x6,%eax
  1016da:	8d 44 06 18          	lea    0x18(%esi,%eax,1),%eax
    ip->type = dip->type;
  1016de:	0f b7 10             	movzwl (%eax),%edx
  1016e1:	66 89 53 10          	mov    %dx,0x10(%ebx)
    ip->major = dip->major;
  1016e5:	0f b7 50 02          	movzwl 0x2(%eax),%edx
  1016e9:	66 89 53 12          	mov    %dx,0x12(%ebx)
    ip->minor = dip->minor;
  1016ed:	0f b7 50 04          	movzwl 0x4(%eax),%edx
  1016f1:	66 89 53 14          	mov    %dx,0x14(%ebx)
    ip->nlink = dip->nlink;
  1016f5:	0f b7 50 06          	movzwl 0x6(%eax),%edx
  1016f9:	66 89 53 16          	mov    %dx,0x16(%ebx)
    ip->size = dip->size;
  1016fd:	8b 50 08             	mov    0x8(%eax),%edx
    memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
  101700:	83 c0 0c             	add    $0xc,%eax
    dip = (struct dinode*)bp->data + ip->inum%IPB;
    ip->type = dip->type;
    ip->major = dip->major;
    ip->minor = dip->minor;
    ip->nlink = dip->nlink;
    ip->size = dip->size;
  101703:	89 53 18             	mov    %edx,0x18(%ebx)
    memmove(ip->addrs, dip->addrs, sizeof(ip->addrs));
  101706:	89 44 24 04          	mov    %eax,0x4(%esp)
  10170a:	8d 43 1c             	lea    0x1c(%ebx),%eax
  10170d:	c7 44 24 08 34 00 00 	movl   $0x34,0x8(%esp)
  101714:	00 
  101715:	89 04 24             	mov    %eax,(%esp)
  101718:	e8 e3 25 00 00       	call   103d00 <memmove>
    brelse(bp);
  10171d:	89 34 24             	mov    %esi,(%esp)
  101720:	e8 bb eb ff ff       	call   1002e0 <brelse>
    ip->flags |= I_VALID;
  101725:	83 4b 0c 02          	orl    $0x2,0xc(%ebx)
    if(ip->type == 0)
  101729:	66 83 7b 10 00       	cmpw   $0x0,0x10(%ebx)
  10172e:	0f 85 7b ff ff ff    	jne    1016af <ilock+0x5f>
      panic("ilock: no type");
  101734:	c7 04 24 b6 5d 10 00 	movl   $0x105db6,(%esp)
  10173b:	e8 60 f0 ff ff       	call   1007a0 <panic>
{
  struct buf *bp;
  struct dinode *dip;

  if(ip == 0 || ip->ref < 1)
    panic("ilock");
  101740:	c7 04 24 b0 5d 10 00 	movl   $0x105db0,(%esp)
  101747:	e8 54 f0 ff ff       	call   1007a0 <panic>
  10174c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

00101750 <iunlock>:
}

// Unlock the given inode.
void
iunlock(struct inode *ip)
{
  101750:	53                   	push   %ebx
  101751:	83 ec 18             	sub    $0x18,%esp
  101754:	8b 5c 24 20          	mov    0x20(%esp),%ebx
  if(ip == 0 || !(ip->flags & I_BUSY) || ip->ref < 1)
  101758:	85 db                	test   %ebx,%ebx
  10175a:	74 36                	je     101792 <iunlock+0x42>
  10175c:	f6 43 0c 01          	testb  $0x1,0xc(%ebx)
  101760:	74 30                	je     101792 <iunlock+0x42>
  101762:	8b 4b 08             	mov    0x8(%ebx),%ecx
  101765:	85 c9                	test   %ecx,%ecx
  101767:	7e 29                	jle    101792 <iunlock+0x42>
    panic("iunlock");

  acquire(&icache.lock);
  101769:	c7 04 24 40 aa 10 00 	movl   $0x10aa40,(%esp)
  101770:	e8 fb 23 00 00       	call   103b70 <acquire>
  ip->flags &= ~I_BUSY;
  101775:	83 63 0c fe          	andl   $0xfffffffe,0xc(%ebx)
  wakeup(ip);
  101779:	89 1c 24             	mov    %ebx,(%esp)
  10177c:	e8 3f 20 00 00       	call   1037c0 <wakeup>
  release(&icache.lock);
  101781:	c7 44 24 20 40 aa 10 	movl   $0x10aa40,0x20(%esp)
  101788:	00 
}
  101789:	83 c4 18             	add    $0x18,%esp
  10178c:	5b                   	pop    %ebx
    panic("iunlock");

  acquire(&icache.lock);
  ip->flags &= ~I_BUSY;
  wakeup(ip);
  release(&icache.lock);
  10178d:	e9 9e 24 00 00       	jmp    103c30 <release>
// Unlock the given inode.
void
iunlock(struct inode *ip)
{
  if(ip == 0 || !(ip->flags & I_BUSY) || ip->ref < 1)
    panic("iunlock");
  101792:	c7 04 24 c5 5d 10 00 	movl   $0x105dc5,(%esp)
  101799:	e8 02 f0 ff ff       	call   1007a0 <panic>
  10179e:	66 90                	xchg   %ax,%ax

001017a0 <iput>:
}

// Caller holds reference to unlocked ip.  Drop reference.
void
iput(struct inode *ip)
{
  1017a0:	55                   	push   %ebp
  1017a1:	57                   	push   %edi
  1017a2:	56                   	push   %esi
  1017a3:	53                   	push   %ebx
  1017a4:	83 ec 1c             	sub    $0x1c,%esp
  1017a7:	8b 74 24 30          	mov    0x30(%esp),%esi
  acquire(&icache.lock);
  1017ab:	c7 04 24 40 aa 10 00 	movl   $0x10aa40,(%esp)
  1017b2:	e8 b9 23 00 00       	call   103b70 <acquire>
  if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
  1017b7:	8b 46 08             	mov    0x8(%esi),%eax
  1017ba:	83 f8 01             	cmp    $0x1,%eax
  1017bd:	0f 85 a2 00 00 00    	jne    101865 <iput+0xc5>
  1017c3:	8b 56 0c             	mov    0xc(%esi),%edx
  1017c6:	f6 c2 02             	test   $0x2,%dl
  1017c9:	0f 84 96 00 00 00    	je     101865 <iput+0xc5>
  1017cf:	66 83 7e 16 00       	cmpw   $0x0,0x16(%esi)
  1017d4:	0f 85 8b 00 00 00    	jne    101865 <iput+0xc5>
    // inode is no longer used: truncate and free inode.
    if(ip->flags & I_BUSY)
  1017da:	f6 c2 01             	test   $0x1,%dl
  1017dd:	0f 85 f8 00 00 00    	jne    1018db <iput+0x13b>
      panic("iput busy");
    ip->flags |= I_BUSY;
  1017e3:	83 ca 01             	or     $0x1,%edx
    release(&icache.lock);
  1017e6:	89 f3                	mov    %esi,%ebx
  acquire(&icache.lock);
  if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
    // inode is no longer used: truncate and free inode.
    if(ip->flags & I_BUSY)
      panic("iput busy");
    ip->flags |= I_BUSY;
  1017e8:	89 56 0c             	mov    %edx,0xc(%esi)
  release(&icache.lock);
}

// Caller holds reference to unlocked ip.  Drop reference.
void
iput(struct inode *ip)
  1017eb:	8d 7e 30             	lea    0x30(%esi),%edi
  if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
    // inode is no longer used: truncate and free inode.
    if(ip->flags & I_BUSY)
      panic("iput busy");
    ip->flags |= I_BUSY;
    release(&icache.lock);
  1017ee:	c7 04 24 40 aa 10 00 	movl   $0x10aa40,(%esp)
  1017f5:	e8 36 24 00 00       	call   103c30 <release>
  1017fa:	eb 0b                	jmp    101807 <iput+0x67>
  1017fc:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  uint *a;

  for(i = 0; i < NDIRECT; i++){
    if(ip->addrs[i]){
      bfree(ip->dev, ip->addrs[i]);
      ip->addrs[i] = 0;
  101800:	83 c3 04             	add    $0x4,%ebx
{
  int i, j;
  struct buf *bp;
  uint *a;

  for(i = 0; i < NDIRECT; i++){
  101803:	39 fb                	cmp    %edi,%ebx
  101805:	74 1c                	je     101823 <iput+0x83>
    if(ip->addrs[i]){
  101807:	8b 53 1c             	mov    0x1c(%ebx),%edx
  10180a:	85 d2                	test   %edx,%edx
  10180c:	74 f2                	je     101800 <iput+0x60>
      bfree(ip->dev, ip->addrs[i]);
  10180e:	8b 06                	mov    (%esi),%eax
  101810:	e8 1b fb ff ff       	call   101330 <bfree>
      ip->addrs[i] = 0;
  101815:	c7 43 1c 00 00 00 00 	movl   $0x0,0x1c(%ebx)
  10181c:	83 c3 04             	add    $0x4,%ebx
{
  int i, j;
  struct buf *bp;
  uint *a;

  for(i = 0; i < NDIRECT; i++){
  10181f:	39 fb                	cmp    %edi,%ebx
  101821:	75 e4                	jne    101807 <iput+0x67>
      bfree(ip->dev, ip->addrs[i]);
      ip->addrs[i] = 0;
    }
  }
  
  if(ip->addrs[NDIRECT]){
  101823:	8b 46 4c             	mov    0x4c(%esi),%eax
  101826:	85 c0                	test   %eax,%eax
  101828:	75 56                	jne    101880 <iput+0xe0>
    brelse(bp);
    bfree(ip->dev, ip->addrs[NDIRECT]);
    ip->addrs[NDIRECT] = 0;
  }

  ip->size = 0;
  10182a:	c7 46 18 00 00 00 00 	movl   $0x0,0x18(%esi)
  iupdate(ip);
  101831:	89 34 24             	mov    %esi,(%esp)
  101834:	e8 57 fd ff ff       	call   101590 <iupdate>
    if(ip->flags & I_BUSY)
      panic("iput busy");
    ip->flags |= I_BUSY;
    release(&icache.lock);
    itrunc(ip);
    ip->type = 0;
  101839:	66 c7 46 10 00 00    	movw   $0x0,0x10(%esi)
    iupdate(ip);
  10183f:	89 34 24             	mov    %esi,(%esp)
  101842:	e8 49 fd ff ff       	call   101590 <iupdate>
    acquire(&icache.lock);
  101847:	c7 04 24 40 aa 10 00 	movl   $0x10aa40,(%esp)
  10184e:	e8 1d 23 00 00       	call   103b70 <acquire>
    ip->flags = 0;
  101853:	c7 46 0c 00 00 00 00 	movl   $0x0,0xc(%esi)
    wakeup(ip);
  10185a:	89 34 24             	mov    %esi,(%esp)
  10185d:	e8 5e 1f 00 00       	call   1037c0 <wakeup>
  101862:	8b 46 08             	mov    0x8(%esi),%eax
  }
  ip->ref--;
  101865:	83 e8 01             	sub    $0x1,%eax
  101868:	89 46 08             	mov    %eax,0x8(%esi)
  release(&icache.lock);
  10186b:	c7 44 24 30 40 aa 10 	movl   $0x10aa40,0x30(%esp)
  101872:	00 
}
  101873:	83 c4 1c             	add    $0x1c,%esp
  101876:	5b                   	pop    %ebx
  101877:	5e                   	pop    %esi
  101878:	5f                   	pop    %edi
  101879:	5d                   	pop    %ebp
    acquire(&icache.lock);
    ip->flags = 0;
    wakeup(ip);
  }
  ip->ref--;
  release(&icache.lock);
  10187a:	e9 b1 23 00 00       	jmp    103c30 <release>
  10187f:	90                   	nop
      ip->addrs[i] = 0;
    }
  }
  
  if(ip->addrs[NDIRECT]){
    bp = bread(ip->dev, ip->addrs[NDIRECT]);
  101880:	89 44 24 04          	mov    %eax,0x4(%esp)
  101884:	8b 06                	mov    (%esi),%eax
    a = (uint*)bp->data;
    for(j = 0; j < NINDIRECT; j++){
  101886:	31 db                	xor    %ebx,%ebx
      ip->addrs[i] = 0;
    }
  }
  
  if(ip->addrs[NDIRECT]){
    bp = bread(ip->dev, ip->addrs[NDIRECT]);
  101888:	89 04 24             	mov    %eax,(%esp)
  10188b:	e8 50 e9 ff ff       	call   1001e0 <bread>
  101890:	89 c5                	mov    %eax,%ebp
    a = (uint*)bp->data;
  101892:	8d 78 18             	lea    0x18(%eax),%edi
    for(j = 0; j < NINDIRECT; j++){
  101895:	31 c0                	xor    %eax,%eax
  101897:	eb 14                	jmp    1018ad <iput+0x10d>
  101899:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  1018a0:	83 c3 01             	add    $0x1,%ebx
  1018a3:	81 fb 80 00 00 00    	cmp    $0x80,%ebx
  1018a9:	89 d8                	mov    %ebx,%eax
  1018ab:	74 10                	je     1018bd <iput+0x11d>
      if(a[j])
  1018ad:	8b 14 87             	mov    (%edi,%eax,4),%edx
  1018b0:	85 d2                	test   %edx,%edx
  1018b2:	74 ec                	je     1018a0 <iput+0x100>
        bfree(ip->dev, a[j]);
  1018b4:	8b 06                	mov    (%esi),%eax
  1018b6:	e8 75 fa ff ff       	call   101330 <bfree>
  1018bb:	eb e3                	jmp    1018a0 <iput+0x100>
    }
    brelse(bp);
  1018bd:	89 2c 24             	mov    %ebp,(%esp)
  1018c0:	e8 1b ea ff ff       	call   1002e0 <brelse>
    bfree(ip->dev, ip->addrs[NDIRECT]);
  1018c5:	8b 56 4c             	mov    0x4c(%esi),%edx
  1018c8:	8b 06                	mov    (%esi),%eax
  1018ca:	e8 61 fa ff ff       	call   101330 <bfree>
    ip->addrs[NDIRECT] = 0;
  1018cf:	c7 46 4c 00 00 00 00 	movl   $0x0,0x4c(%esi)
  1018d6:	e9 4f ff ff ff       	jmp    10182a <iput+0x8a>
{
  acquire(&icache.lock);
  if(ip->ref == 1 && (ip->flags & I_VALID) && ip->nlink == 0){
    // inode is no longer used: truncate and free inode.
    if(ip->flags & I_BUSY)
      panic("iput busy");
  1018db:	c7 04 24 cd 5d 10 00 	movl   $0x105dcd,(%esp)
  1018e2:	e8 b9 ee ff ff       	call   1007a0 <panic>
  1018e7:	89 f6                	mov    %esi,%esi
  1018e9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

001018f0 <iunlockput>:
}

// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
  1018f0:	53                   	push   %ebx
  1018f1:	83 ec 18             	sub    $0x18,%esp
  1018f4:	8b 5c 24 20          	mov    0x20(%esp),%ebx
  iunlock(ip);
  1018f8:	89 1c 24             	mov    %ebx,(%esp)
  1018fb:	e8 50 fe ff ff       	call   101750 <iunlock>
  iput(ip);
  101900:	89 5c 24 20          	mov    %ebx,0x20(%esp)
}
  101904:	83 c4 18             	add    $0x18,%esp
  101907:	5b                   	pop    %ebx
// Common idiom: unlock, then put.
void
iunlockput(struct inode *ip)
{
  iunlock(ip);
  iput(ip);
  101908:	e9 93 fe ff ff       	jmp    1017a0 <iput>
  10190d:	8d 76 00             	lea    0x0(%esi),%esi

00101910 <stati>:
}

// Copy stat information from inode.
void
stati(struct inode *ip, struct statt *st)
{
  101910:	8b 54 24 04          	mov    0x4(%esp),%edx
  101914:	8b 44 24 08          	mov    0x8(%esp),%eax
  st->dev = ip->dev;
  101918:	8b 0a                	mov    (%edx),%ecx
  10191a:	89 48 04             	mov    %ecx,0x4(%eax)
  st->ino = ip->inum;
  10191d:	8b 4a 04             	mov    0x4(%edx),%ecx
  101920:	89 48 08             	mov    %ecx,0x8(%eax)
  st->type = ip->type;
  101923:	0f b7 4a 10          	movzwl 0x10(%edx),%ecx
  101927:	66 89 08             	mov    %cx,(%eax)
  st->nlink = ip->nlink;
  10192a:	0f b7 4a 16          	movzwl 0x16(%edx),%ecx
  10192e:	66 89 48 0c          	mov    %cx,0xc(%eax)
  st->size = ip->size;
  101932:	8b 52 18             	mov    0x18(%edx),%edx
  101935:	89 50 10             	mov    %edx,0x10(%eax)
}
  101938:	c3                   	ret    
  101939:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi

00101940 <readi>:

// Read data from inode.
int
readi(struct inode *ip, char *dst, uint off, uint n)
{
  101940:	55                   	push   %ebp
  101941:	57                   	push   %edi
  101942:	56                   	push   %esi
  101943:	53                   	push   %ebx
  101944:	83 ec 2c             	sub    $0x2c,%esp
  101947:	8b 7c 24 40          	mov    0x40(%esp),%edi
  10194b:	8b 44 24 44          	mov    0x44(%esp),%eax
  10194f:	8b 54 24 4c          	mov    0x4c(%esp),%edx
  101953:	8b 5c 24 48          	mov    0x48(%esp),%ebx
  uint tot, m;
  struct buf *bp;

  if(ip->type == T_DEV){
  101957:	66 83 7f 10 03       	cmpw   $0x3,0x10(%edi)
}

// Read data from inode.
int
readi(struct inode *ip, char *dst, uint off, uint n)
{
  10195c:	89 44 24 18          	mov    %eax,0x18(%esp)
  101960:	89 54 24 1c          	mov    %edx,0x1c(%esp)
  uint tot, m;
  struct buf *bp;

  if(ip->type == T_DEV){
  101964:	0f 84 b6 00 00 00    	je     101a20 <readi+0xe0>
    if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
      return -1;
    return devsw[ip->major].read(ip, dst, n);
  }

  if(off > ip->size || off + n < off)
  10196a:	8b 57 18             	mov    0x18(%edi),%edx
    return -1;
  10196d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
    if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
      return -1;
    return devsw[ip->major].read(ip, dst, n);
  }

  if(off > ip->size || off + n < off)
  101972:	39 da                	cmp    %ebx,%edx
  101974:	0f 82 8e 00 00 00    	jb     101a08 <readi+0xc8>
  10197a:	8b 4c 24 1c          	mov    0x1c(%esp),%ecx
  10197e:	01 d9                	add    %ebx,%ecx
  101980:	0f 82 82 00 00 00    	jb     101a08 <readi+0xc8>
    return -1;
  if(off + n > ip->size)
  101986:	39 ca                	cmp    %ecx,%edx
  101988:	0f 82 82 00 00 00    	jb     101a10 <readi+0xd0>
    n = ip->size - off;

  for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
  10198e:	8b 74 24 1c          	mov    0x1c(%esp),%esi
  101992:	85 f6                	test   %esi,%esi
  101994:	74 6e                	je     101a04 <readi+0xc4>
  101996:	31 f6                	xor    %esi,%esi
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
  101998:	89 da                	mov    %ebx,%edx
  10199a:	89 f8                	mov    %edi,%eax
  10199c:	c1 ea 09             	shr    $0x9,%edx
    m = min(n - tot, BSIZE - off%BSIZE);
  10199f:	bd 00 02 00 00       	mov    $0x200,%ebp
    return -1;
  if(off + n > ip->size)
    n = ip->size - off;

  for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
  1019a4:	e8 47 fa ff ff       	call   1013f0 <bmap>
  1019a9:	89 44 24 04          	mov    %eax,0x4(%esp)
  1019ad:	8b 07                	mov    (%edi),%eax
  1019af:	89 04 24             	mov    %eax,(%esp)
  1019b2:	e8 29 e8 ff ff       	call   1001e0 <bread>
    m = min(n - tot, BSIZE - off%BSIZE);
  1019b7:	8b 4c 24 1c          	mov    0x1c(%esp),%ecx
  1019bb:	29 f1                	sub    %esi,%ecx
    return -1;
  if(off + n > ip->size)
    n = ip->size - off;

  for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
  1019bd:	89 c2                	mov    %eax,%edx
    m = min(n - tot, BSIZE - off%BSIZE);
  1019bf:	89 d8                	mov    %ebx,%eax
  1019c1:	25 ff 01 00 00       	and    $0x1ff,%eax
  1019c6:	29 c5                	sub    %eax,%ebp
  1019c8:	39 cd                	cmp    %ecx,%ebp
  1019ca:	76 02                	jbe    1019ce <readi+0x8e>
  1019cc:	89 cd                	mov    %ecx,%ebp
    memmove(dst, bp->data + off%BSIZE, m);
  1019ce:	8d 44 02 18          	lea    0x18(%edx,%eax,1),%eax
  if(off > ip->size || off + n < off)
    return -1;
  if(off + n > ip->size)
    n = ip->size - off;

  for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
  1019d2:	01 ee                	add    %ebp,%esi
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
    m = min(n - tot, BSIZE - off%BSIZE);
    memmove(dst, bp->data + off%BSIZE, m);
  1019d4:	89 44 24 04          	mov    %eax,0x4(%esp)
  1019d8:	8b 44 24 18          	mov    0x18(%esp),%eax
  if(off > ip->size || off + n < off)
    return -1;
  if(off + n > ip->size)
    n = ip->size - off;

  for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
  1019dc:	01 eb                	add    %ebp,%ebx
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
    m = min(n - tot, BSIZE - off%BSIZE);
    memmove(dst, bp->data + off%BSIZE, m);
  1019de:	89 54 24 14          	mov    %edx,0x14(%esp)
  1019e2:	89 6c 24 08          	mov    %ebp,0x8(%esp)
  1019e6:	89 04 24             	mov    %eax,(%esp)
  1019e9:	e8 12 23 00 00       	call   103d00 <memmove>
    brelse(bp);
  1019ee:	8b 54 24 14          	mov    0x14(%esp),%edx
  1019f2:	89 14 24             	mov    %edx,(%esp)
  1019f5:	e8 e6 e8 ff ff       	call   1002e0 <brelse>
  if(off > ip->size || off + n < off)
    return -1;
  if(off + n > ip->size)
    n = ip->size - off;

  for(tot=0; tot<n; tot+=m, off+=m, dst+=m){
  1019fa:	01 6c 24 18          	add    %ebp,0x18(%esp)
  1019fe:	39 74 24 1c          	cmp    %esi,0x1c(%esp)
  101a02:	77 94                	ja     101998 <readi+0x58>
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
    m = min(n - tot, BSIZE - off%BSIZE);
    memmove(dst, bp->data + off%BSIZE, m);
    brelse(bp);
  }
  return n;
  101a04:	8b 44 24 1c          	mov    0x1c(%esp),%eax
}
  101a08:	83 c4 2c             	add    $0x2c,%esp
  101a0b:	5b                   	pop    %ebx
  101a0c:	5e                   	pop    %esi
  101a0d:	5f                   	pop    %edi
  101a0e:	5d                   	pop    %ebp
  101a0f:	c3                   	ret    
  }

  if(off > ip->size || off + n < off)
    return -1;
  if(off + n > ip->size)
    n = ip->size - off;
  101a10:	29 da                	sub    %ebx,%edx
  101a12:	89 54 24 1c          	mov    %edx,0x1c(%esp)
  101a16:	e9 73 ff ff ff       	jmp    10198e <readi+0x4e>
  101a1b:	90                   	nop
  101a1c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
{
  uint tot, m;
  struct buf *bp;

  if(ip->type == T_DEV){
    if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
  101a20:	0f b7 47 12          	movzwl 0x12(%edi),%eax
  101a24:	66 83 f8 09          	cmp    $0x9,%ax
  101a28:	77 19                	ja     101a43 <readi+0x103>
  101a2a:	98                   	cwtl   
  101a2b:	8b 04 c5 e0 a9 10 00 	mov    0x10a9e0(,%eax,8),%eax
  101a32:	85 c0                	test   %eax,%eax
  101a34:	74 0d                	je     101a43 <readi+0x103>
      return -1;
    return devsw[ip->major].read(ip, dst, n);
  101a36:	89 54 24 48          	mov    %edx,0x48(%esp)
    m = min(n - tot, BSIZE - off%BSIZE);
    memmove(dst, bp->data + off%BSIZE, m);
    brelse(bp);
  }
  return n;
}
  101a3a:	83 c4 2c             	add    $0x2c,%esp
  101a3d:	5b                   	pop    %ebx
  101a3e:	5e                   	pop    %esi
  101a3f:	5f                   	pop    %edi
  101a40:	5d                   	pop    %ebp
  struct buf *bp;

  if(ip->type == T_DEV){
    if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
      return -1;
    return devsw[ip->major].read(ip, dst, n);
  101a41:	ff e0                	jmp    *%eax
  uint tot, m;
  struct buf *bp;

  if(ip->type == T_DEV){
    if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].read)
      return -1;
  101a43:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
  101a48:	eb be                	jmp    101a08 <readi+0xc8>
  101a4a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi

00101a50 <writei>:
}

// Write data to inode.
int
writei(struct inode *ip, char *src, uint off, uint n)
{
  101a50:	55                   	push   %ebp
  101a51:	57                   	push   %edi
  101a52:	56                   	push   %esi
  101a53:	53                   	push   %ebx
  101a54:	83 ec 2c             	sub    $0x2c,%esp
  101a57:	8b 4c 24 44          	mov    0x44(%esp),%ecx
  101a5b:	8b 7c 24 40          	mov    0x40(%esp),%edi
  101a5f:	8b 5c 24 48          	mov    0x48(%esp),%ebx
  101a63:	89 4c 24 18          	mov    %ecx,0x18(%esp)
  101a67:	8b 4c 24 4c          	mov    0x4c(%esp),%ecx
  uint tot, m;
  struct buf *bp;

  if(ip->type == T_DEV){
  101a6b:	66 83 7f 10 03       	cmpw   $0x3,0x10(%edi)
}

// Write data to inode.
int
writei(struct inode *ip, char *src, uint off, uint n)
{
  101a70:	89 4c 24 1c          	mov    %ecx,0x1c(%esp)
  uint tot, m;
  struct buf *bp;

  if(ip->type == T_DEV){
  101a74:	0f 84 de 00 00 00    	je     101b58 <writei+0x108>
    if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
      return -1;
    return devsw[ip->major].write(ip, src, n);
  }

  if(off > ip->size || off + n < off)
  101a7a:	39 5f 18             	cmp    %ebx,0x18(%edi)
    return -1;
  101a7d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
    if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
      return -1;
    return devsw[ip->major].write(ip, src, n);
  }

  if(off > ip->size || off + n < off)
  101a82:	0f 82 a9 00 00 00    	jb     101b31 <writei+0xe1>
  101a88:	8b 54 24 1c          	mov    0x1c(%esp),%edx
  101a8c:	01 da                	add    %ebx,%edx
  101a8e:	0f 82 9d 00 00 00    	jb     101b31 <writei+0xe1>
    return -1;
  if(off + n > MAXFILE*BSIZE)
  101a94:	81 fa 00 18 01 00    	cmp    $0x11800,%edx
  101a9a:	0f 87 a0 00 00 00    	ja     101b40 <writei+0xf0>
    n = MAXFILE*BSIZE - off;

  for(tot=0; tot<n; tot+=m, off+=m, src+=m){
  101aa0:	8b 6c 24 1c          	mov    0x1c(%esp),%ebp
  101aa4:	85 ed                	test   %ebp,%ebp
  101aa6:	0f 84 81 00 00 00    	je     101b2d <writei+0xdd>
  101aac:	31 f6                	xor    %esi,%esi
  101aae:	66 90                	xchg   %ax,%ax
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
  101ab0:	89 da                	mov    %ebx,%edx
  101ab2:	89 f8                	mov    %edi,%eax
  101ab4:	c1 ea 09             	shr    $0x9,%edx
    m = min(n - tot, BSIZE - off%BSIZE);
  101ab7:	bd 00 02 00 00       	mov    $0x200,%ebp
    return -1;
  if(off + n > MAXFILE*BSIZE)
    n = MAXFILE*BSIZE - off;

  for(tot=0; tot<n; tot+=m, off+=m, src+=m){
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
  101abc:	e8 2f f9 ff ff       	call   1013f0 <bmap>
  101ac1:	89 44 24 04          	mov    %eax,0x4(%esp)
  101ac5:	8b 07                	mov    (%edi),%eax
  101ac7:	89 04 24             	mov    %eax,(%esp)
  101aca:	e8 11 e7 ff ff       	call   1001e0 <bread>
    m = min(n - tot, BSIZE - off%BSIZE);
  101acf:	8b 4c 24 1c          	mov    0x1c(%esp),%ecx
  101ad3:	29 f1                	sub    %esi,%ecx
    return -1;
  if(off + n > MAXFILE*BSIZE)
    n = MAXFILE*BSIZE - off;

  for(tot=0; tot<n; tot+=m, off+=m, src+=m){
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
  101ad5:	89 c2                	mov    %eax,%edx
    m = min(n - tot, BSIZE - off%BSIZE);
  101ad7:	89 d8                	mov    %ebx,%eax
  101ad9:	25 ff 01 00 00       	and    $0x1ff,%eax
  101ade:	29 c5                	sub    %eax,%ebp
  101ae0:	39 cd                	cmp    %ecx,%ebp
  101ae2:	76 02                	jbe    101ae6 <writei+0x96>
  101ae4:	89 cd                	mov    %ecx,%ebp
    memmove(bp->data + off%BSIZE, src, m);
  101ae6:	8b 4c 24 18          	mov    0x18(%esp),%ecx
  101aea:	8d 44 02 18          	lea    0x18(%edx,%eax,1),%eax
  if(off > ip->size || off + n < off)
    return -1;
  if(off + n > MAXFILE*BSIZE)
    n = MAXFILE*BSIZE - off;

  for(tot=0; tot<n; tot+=m, off+=m, src+=m){
  101aee:	01 ee                	add    %ebp,%esi
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
    m = min(n - tot, BSIZE - off%BSIZE);
    memmove(bp->data + off%BSIZE, src, m);
  101af0:	89 54 24 14          	mov    %edx,0x14(%esp)
  if(off > ip->size || off + n < off)
    return -1;
  if(off + n > MAXFILE*BSIZE)
    n = MAXFILE*BSIZE - off;

  for(tot=0; tot<n; tot+=m, off+=m, src+=m){
  101af4:	01 eb                	add    %ebp,%ebx
    bp = bread(ip->dev, bmap(ip, off/BSIZE));
    m = min(n - tot, BSIZE - off%BSIZE);
    memmove(bp->data + off%BSIZE, src, m);
  101af6:	89 6c 24 08          	mov    %ebp,0x8(%esp)
  101afa:	89 04 24             	mov    %eax,(%esp)
  101afd:	89 4c 24 04          	mov    %ecx,0x4(%esp)
  101b01:	e8 fa 21 00 00       	call   103d00 <memmove>
    bwrite(bp);
  101b06:	8b 54 24 14          	mov    0x14(%esp),%edx
  101b0a:	89 14 24             	mov    %edx,(%esp)
  101b0d:	e8 9e e7 ff ff       	call   1002b0 <bwrite>
    brelse(bp);
  101b12:	8b 54 24 14          	mov    0x14(%esp),%edx
  101b16:	89 14 24             	mov    %edx,(%esp)
  101b19:	e8 c2 e7 ff ff       	call   1002e0 <brelse>
  if(off > ip->size || off + n < off)
    return -1;
  if(off + n > MAXFILE*BSIZE)
    n = MAXFILE*BSIZE - off;

  for(tot=0; tot<n; tot+=m, off+=m, src+=m){
  101b1e:	01 6c 24 18          	add    %ebp,0x18(%esp)
  101b22:	39 74 24 1c          	cmp    %esi,0x1c(%esp)
  101b26:	77 88                	ja     101ab0 <writei+0x60>
    memmove(bp->data + off%BSIZE, src, m);
    bwrite(bp);
    brelse(bp);
  }

  if(n > 0 && off > ip->size){
  101b28:	39 5f 18             	cmp    %ebx,0x18(%edi)
  101b2b:	72 53                	jb     101b80 <writei+0x130>
    ip->size = off;
    iupdate(ip);
  }
  return n;
  101b2d:	8b 44 24 1c          	mov    0x1c(%esp),%eax
}
  101b31:	83 c4 2c             	add    $0x2c,%esp
  101b34:	5b                   	pop    %ebx
  101b35:	5e                   	pop    %esi
  101b36:	5f                   	pop    %edi
  101b37:	5d                   	pop    %ebp
  101b38:	c3                   	ret    
  101b39:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  }

  if(off > ip->size || off + n < off)
    return -1;
  if(off + n > MAXFILE*BSIZE)
    n = MAXFILE*BSIZE - off;
  101b40:	c7 44 24 1c 00 18 01 	movl   $0x11800,0x1c(%esp)
  101b47:	00 
  101b48:	29 5c 24 1c          	sub    %ebx,0x1c(%esp)
  101b4c:	e9 4f ff ff ff       	jmp    101aa0 <writei+0x50>
  101b51:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
{
  uint tot, m;
  struct buf *bp;

  if(ip->type == T_DEV){
    if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
  101b58:	0f b7 47 12          	movzwl 0x12(%edi),%eax
  101b5c:	66 83 f8 09          	cmp    $0x9,%ax
  101b60:	77 2b                	ja     101b8d <writei+0x13d>
  101b62:	98                   	cwtl   
  101b63:	8b 04 c5 e4 a9 10 00 	mov    0x10a9e4(,%eax,8),%eax
  101b6a:	85 c0                	test   %eax,%eax
  101b6c:	74 1f                	je     101b8d <writei+0x13d>
      return -1;
    return devsw[ip->major].write(ip, src, n);
  101b6e:	89 4c 24 48          	mov    %ecx,0x48(%esp)
  if(n > 0 && off > ip->size){
    ip->size = off;
    iupdate(ip);
  }
  return n;
}
  101b72:	83 c4 2c             	add    $0x2c,%esp
  101b75:	5b                   	pop    %ebx
  101b76:	5e                   	pop    %esi
  101b77:	5f                   	pop    %edi
  101b78:	5d                   	pop    %ebp
  struct buf *bp;

  if(ip->type == T_DEV){
    if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
      return -1;
    return devsw[ip->major].write(ip, src, n);
  101b79:	ff e0                	jmp    *%eax
  101b7b:	90                   	nop
  101b7c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    bwrite(bp);
    brelse(bp);
  }

  if(n > 0 && off > ip->size){
    ip->size = off;
  101b80:	89 5f 18             	mov    %ebx,0x18(%edi)
    iupdate(ip);
  101b83:	89 3c 24             	mov    %edi,(%esp)
  101b86:	e8 05 fa ff ff       	call   101590 <iupdate>
  101b8b:	eb a0                	jmp    101b2d <writei+0xdd>
  uint tot, m;
  struct buf *bp;

  if(ip->type == T_DEV){
    if(ip->major < 0 || ip->major >= NDEV || !devsw[ip->major].write)
      return -1;
  101b8d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
  101b92:	eb 9d                	jmp    101b31 <writei+0xe1>
  101b94:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  101b9a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00101ba0 <namecmp>:

// Directories

int
namecmp(const char *s, const char *t)
{
  101ba0:	83 ec 1c             	sub    $0x1c,%esp
  return strncmp(s, t, DIRSIZ);
  101ba3:	8b 44 24 24          	mov    0x24(%esp),%eax
  101ba7:	c7 44 24 08 0e 00 00 	movl   $0xe,0x8(%esp)
  101bae:	00 
  101baf:	89 44 24 04          	mov    %eax,0x4(%esp)
  101bb3:	8b 44 24 20          	mov    0x20(%esp),%eax
  101bb7:	89 04 24             	mov    %eax,(%esp)
  101bba:	e8 c1 21 00 00       	call   103d80 <strncmp>
}
  101bbf:	83 c4 1c             	add    $0x1c,%esp
  101bc2:	c3                   	ret    
  101bc3:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  101bc9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00101bd0 <dirlookup>:
// Look for a directory entry in a directory.
// If found, set *poff to byte offset of entry.
// Caller must have already locked dp.
struct inode*
dirlookup(struct inode *dp, char *name, uint *poff)
{
  101bd0:	55                   	push   %ebp
  101bd1:	57                   	push   %edi
  101bd2:	56                   	push   %esi
  101bd3:	53                   	push   %ebx
  101bd4:	83 ec 2c             	sub    $0x2c,%esp
  101bd7:	8b 74 24 40          	mov    0x40(%esp),%esi
  101bdb:	8b 44 24 48          	mov    0x48(%esp),%eax
  101bdf:	8b 5c 24 44          	mov    0x44(%esp),%ebx
  uint off, inum;
  struct buf *bp;
  struct dirent *de;

  if(dp->type != T_DIR)
  101be3:	66 83 7e 10 01       	cmpw   $0x1,0x10(%esi)
// Look for a directory entry in a directory.
// If found, set *poff to byte offset of entry.
// Caller must have already locked dp.
struct inode*
dirlookup(struct inode *dp, char *name, uint *poff)
{
  101be8:	89 44 24 1c          	mov    %eax,0x1c(%esp)
  uint off, inum;
  struct buf *bp;
  struct dirent *de;

  if(dp->type != T_DIR)
  101bec:	0f 85 d1 00 00 00    	jne    101cc3 <dirlookup+0xf3>
    panic("dirlookup not DIR");

  for(off = 0; off < dp->size; off += BSIZE){
  101bf2:	8b 46 18             	mov    0x18(%esi),%eax
  101bf5:	c7 44 24 14 00 00 00 	movl   $0x0,0x14(%esp)
  101bfc:	00 
  101bfd:	85 c0                	test   %eax,%eax
  101bff:	0f 84 b4 00 00 00    	je     101cb9 <dirlookup+0xe9>
    bp = bread(dp->dev, bmap(dp, off / BSIZE));
  101c05:	8b 54 24 14          	mov    0x14(%esp),%edx
  101c09:	89 f0                	mov    %esi,%eax
  101c0b:	c1 ea 09             	shr    $0x9,%edx
  101c0e:	e8 dd f7 ff ff       	call   1013f0 <bmap>
  101c13:	89 44 24 04          	mov    %eax,0x4(%esp)
  101c17:	8b 06                	mov    (%esi),%eax
  101c19:	89 04 24             	mov    %eax,(%esp)
  101c1c:	e8 bf e5 ff ff       	call   1001e0 <bread>
  101c21:	89 44 24 10          	mov    %eax,0x10(%esp)
    for(de = (struct dirent*)bp->data;
        de < (struct dirent*)(bp->data + BSIZE);
  101c25:	8b 6c 24 10          	mov    0x10(%esp),%ebp
  if(dp->type != T_DIR)
    panic("dirlookup not DIR");

  for(off = 0; off < dp->size; off += BSIZE){
    bp = bread(dp->dev, bmap(dp, off / BSIZE));
    for(de = (struct dirent*)bp->data;
  101c29:	83 c0 18             	add    $0x18,%eax
  101c2c:	89 44 24 18          	mov    %eax,0x18(%esp)
  101c30:	89 c7                	mov    %eax,%edi
        de < (struct dirent*)(bp->data + BSIZE);
  101c32:	81 c5 18 02 00 00    	add    $0x218,%ebp
  101c38:	eb 0d                	jmp    101c47 <dirlookup+0x77>
  101c3a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
        de++){
  101c40:	83 c7 10             	add    $0x10,%edi
  if(dp->type != T_DIR)
    panic("dirlookup not DIR");

  for(off = 0; off < dp->size; off += BSIZE){
    bp = bread(dp->dev, bmap(dp, off / BSIZE));
    for(de = (struct dirent*)bp->data;
  101c43:	39 ef                	cmp    %ebp,%edi
  101c45:	73 51                	jae    101c98 <dirlookup+0xc8>
        de < (struct dirent*)(bp->data + BSIZE);
        de++){
      if(de->inum == 0)
  101c47:	66 83 3f 00          	cmpw   $0x0,(%edi)
  101c4b:	74 f3                	je     101c40 <dirlookup+0x70>
        continue;
      if(namecmp(name, de->name) == 0){
  101c4d:	8d 47 02             	lea    0x2(%edi),%eax
  101c50:	89 44 24 04          	mov    %eax,0x4(%esp)
  101c54:	89 1c 24             	mov    %ebx,(%esp)
  101c57:	e8 44 ff ff ff       	call   101ba0 <namecmp>
  101c5c:	85 c0                	test   %eax,%eax
  101c5e:	75 e0                	jne    101c40 <dirlookup+0x70>
        // entry matches path element
        if(poff)
  101c60:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  101c64:	85 c0                	test   %eax,%eax
  101c66:	74 10                	je     101c78 <dirlookup+0xa8>
          *poff = off + (uchar*)de - bp->data;
  101c68:	8b 44 24 14          	mov    0x14(%esp),%eax
  101c6c:	8b 54 24 1c          	mov    0x1c(%esp),%edx
  101c70:	01 f8                	add    %edi,%eax
  101c72:	2b 44 24 18          	sub    0x18(%esp),%eax
  101c76:	89 02                	mov    %eax,(%edx)
        inum = de->inum;
        brelse(bp);
  101c78:	8b 44 24 10          	mov    0x10(%esp),%eax
        continue;
      if(namecmp(name, de->name) == 0){
        // entry matches path element
        if(poff)
          *poff = off + (uchar*)de - bp->data;
        inum = de->inum;
  101c7c:	0f b7 1f             	movzwl (%edi),%ebx
        brelse(bp);
  101c7f:	89 04 24             	mov    %eax,(%esp)
  101c82:	e8 59 e6 ff ff       	call   1002e0 <brelse>
        return iget(dp->dev, inum);
  101c87:	8b 06                	mov    (%esi),%eax
      }
    }
    brelse(bp);
  }
  return 0;
}
  101c89:	83 c4 2c             	add    $0x2c,%esp
        // entry matches path element
        if(poff)
          *poff = off + (uchar*)de - bp->data;
        inum = de->inum;
        brelse(bp);
        return iget(dp->dev, inum);
  101c8c:	89 da                	mov    %ebx,%edx
      }
    }
    brelse(bp);
  }
  return 0;
}
  101c8e:	5b                   	pop    %ebx
  101c8f:	5e                   	pop    %esi
  101c90:	5f                   	pop    %edi
  101c91:	5d                   	pop    %ebp
        // entry matches path element
        if(poff)
          *poff = off + (uchar*)de - bp->data;
        inum = de->inum;
        brelse(bp);
        return iget(dp->dev, inum);
  101c92:	e9 b9 f4 ff ff       	jmp    101150 <iget>
  101c97:	90                   	nop
      }
    }
    brelse(bp);
  101c98:	8b 44 24 10          	mov    0x10(%esp),%eax
  101c9c:	89 04 24             	mov    %eax,(%esp)
  101c9f:	e8 3c e6 ff ff       	call   1002e0 <brelse>
  struct dirent *de;

  if(dp->type != T_DIR)
    panic("dirlookup not DIR");

  for(off = 0; off < dp->size; off += BSIZE){
  101ca4:	81 44 24 14 00 02 00 	addl   $0x200,0x14(%esp)
  101cab:	00 
  101cac:	8b 54 24 14          	mov    0x14(%esp),%edx
  101cb0:	39 56 18             	cmp    %edx,0x18(%esi)
  101cb3:	0f 87 4c ff ff ff    	ja     101c05 <dirlookup+0x35>
      }
    }
    brelse(bp);
  }
  return 0;
}
  101cb9:	83 c4 2c             	add    $0x2c,%esp
  101cbc:	31 c0                	xor    %eax,%eax
  101cbe:	5b                   	pop    %ebx
  101cbf:	5e                   	pop    %esi
  101cc0:	5f                   	pop    %edi
  101cc1:	5d                   	pop    %ebp
  101cc2:	c3                   	ret    
  uint off, inum;
  struct buf *bp;
  struct dirent *de;

  if(dp->type != T_DIR)
    panic("dirlookup not DIR");
  101cc3:	c7 04 24 d7 5d 10 00 	movl   $0x105dd7,(%esp)
  101cca:	e8 d1 ea ff ff       	call   1007a0 <panic>
  101ccf:	90                   	nop

00101cd0 <namex>:
// Look up and return the inode for a path name.
// If parent != 0, return the inode for the parent and copy the final
// path element into name, which must have room for DIRSIZ bytes.
static struct inode*
namex(char *path, int nameiparent, char *name)
{
  101cd0:	55                   	push   %ebp
  101cd1:	57                   	push   %edi
  101cd2:	56                   	push   %esi
  101cd3:	89 ce                	mov    %ecx,%esi
  101cd5:	53                   	push   %ebx
  101cd6:	89 c3                	mov    %eax,%ebx
  101cd8:	83 ec 2c             	sub    $0x2c,%esp
  struct inode *ip, *next;

  if(*path == '/')
  101cdb:	80 38 2f             	cmpb   $0x2f,(%eax)
// Look up and return the inode for a path name.
// If parent != 0, return the inode for the parent and copy the final
// path element into name, which must have room for DIRSIZ bytes.
static struct inode*
namex(char *path, int nameiparent, char *name)
{
  101cde:	89 54 24 1c          	mov    %edx,0x1c(%esp)
  struct inode *ip, *next;

  if(*path == '/')
  101ce2:	0f 84 0b 01 00 00    	je     101df3 <namex+0x123>
    ip = iget(ROOTDEV, ROOTINO);
  else
    ip = idup(proc->cwd);
  101ce8:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  101cee:	8b 40 68             	mov    0x68(%eax),%eax
  101cf1:	89 04 24             	mov    %eax,(%esp)
  101cf4:	e8 27 f9 ff ff       	call   101620 <idup>
  101cf9:	89 c5                	mov    %eax,%ebp
  101cfb:	eb 06                	jmp    101d03 <namex+0x33>
  101cfd:	8d 76 00             	lea    0x0(%esi),%esi
{
  char *s;
  int len;

  while(*path == '/')
    path++;
  101d00:	83 c3 01             	add    $0x1,%ebx
skipelem(char *path, char *name)
{
  char *s;
  int len;

  while(*path == '/')
  101d03:	0f b6 03             	movzbl (%ebx),%eax
  101d06:	3c 2f                	cmp    $0x2f,%al
  101d08:	74 f6                	je     101d00 <namex+0x30>
    path++;
  if(*path == 0)
  101d0a:	84 c0                	test   %al,%al
  101d0c:	75 1a                	jne    101d28 <namex+0x58>
      return 0;
    }
    iunlockput(ip);
    ip = next;
  }
  if(nameiparent){
  101d0e:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  101d12:	85 c0                	test   %eax,%eax
  101d14:	0f 85 26 01 00 00    	jne    101e40 <namex+0x170>
    iput(ip);
    return 0;
  }
  return ip;
}
  101d1a:	83 c4 2c             	add    $0x2c,%esp
  101d1d:	89 e8                	mov    %ebp,%eax
  101d1f:	5b                   	pop    %ebx
  101d20:	5e                   	pop    %esi
  101d21:	5f                   	pop    %edi
  101d22:	5d                   	pop    %ebp
  101d23:	c3                   	ret    
  101d24:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  while(*path == '/')
    path++;
  if(*path == 0)
    return 0;
  s = path;
  while(*path != '/' && *path != 0)
  101d28:	0f b6 03             	movzbl (%ebx),%eax
  101d2b:	89 df                	mov    %ebx,%edi
  101d2d:	84 c0                	test   %al,%al
  101d2f:	0f 84 98 00 00 00    	je     101dcd <namex+0xfd>
  101d35:	3c 2f                	cmp    $0x2f,%al
  101d37:	75 0b                	jne    101d44 <namex+0x74>
  101d39:	e9 8f 00 00 00       	jmp    101dcd <namex+0xfd>
  101d3e:	66 90                	xchg   %ax,%ax
  101d40:	3c 2f                	cmp    $0x2f,%al
  101d42:	74 0a                	je     101d4e <namex+0x7e>
    path++;
  101d44:	83 c7 01             	add    $0x1,%edi
  while(*path == '/')
    path++;
  if(*path == 0)
    return 0;
  s = path;
  while(*path != '/' && *path != 0)
  101d47:	0f b6 07             	movzbl (%edi),%eax
  101d4a:	84 c0                	test   %al,%al
  101d4c:	75 f2                	jne    101d40 <namex+0x70>
  101d4e:	89 fa                	mov    %edi,%edx
  101d50:	29 da                	sub    %ebx,%edx
    path++;
  len = path - s;
  if(len >= DIRSIZ)
  101d52:	83 fa 0d             	cmp    $0xd,%edx
  101d55:	7e 79                	jle    101dd0 <namex+0x100>
    memmove(name, s, DIRSIZ);
  101d57:	89 5c 24 04          	mov    %ebx,0x4(%esp)
    path++;
  if(*path == 0)
    return 0;
  s = path;
  while(*path != '/' && *path != 0)
    path++;
  101d5b:	89 fb                	mov    %edi,%ebx
  len = path - s;
  if(len >= DIRSIZ)
    memmove(name, s, DIRSIZ);
  101d5d:	c7 44 24 08 0e 00 00 	movl   $0xe,0x8(%esp)
  101d64:	00 
  101d65:	89 34 24             	mov    %esi,(%esp)
  101d68:	e8 93 1f 00 00       	call   103d00 <memmove>
  else {
    memmove(name, s, len);
    name[len] = 0;
  }
  while(*path == '/')
  101d6d:	80 3f 2f             	cmpb   $0x2f,(%edi)
  101d70:	75 0e                	jne    101d80 <namex+0xb0>
  101d72:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    path++;
  101d78:	83 c3 01             	add    $0x1,%ebx
    memmove(name, s, DIRSIZ);
  else {
    memmove(name, s, len);
    name[len] = 0;
  }
  while(*path == '/')
  101d7b:	80 3b 2f             	cmpb   $0x2f,(%ebx)
  101d7e:	74 f8                	je     101d78 <namex+0xa8>
  if(*path == '/')
    ip = iget(ROOTDEV, ROOTINO);
  else
    ip = idup(proc->cwd);

  while((path = skipelem(path, name)) != 0){
  101d80:	85 db                	test   %ebx,%ebx
  101d82:	74 8a                	je     101d0e <namex+0x3e>
    ilock(ip);
  101d84:	89 2c 24             	mov    %ebp,(%esp)
  101d87:	e8 c4 f8 ff ff       	call   101650 <ilock>
    if(ip->type != T_DIR){
  101d8c:	66 83 7d 10 01       	cmpw   $0x1,0x10(%ebp)
  101d91:	75 76                	jne    101e09 <namex+0x139>
      iunlockput(ip);
      return 0;
    }
    if(nameiparent && *path == '\0'){
  101d93:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  101d97:	85 c0                	test   %eax,%eax
  101d99:	74 09                	je     101da4 <namex+0xd4>
  101d9b:	80 3b 00             	cmpb   $0x0,(%ebx)
  101d9e:	0f 84 8a 00 00 00    	je     101e2e <namex+0x15e>
      // Stop one level early.
      iunlock(ip);
      return ip;
    }
    if((next = dirlookup(ip, name, 0)) == 0){
  101da4:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
  101dab:	00 
  101dac:	89 74 24 04          	mov    %esi,0x4(%esp)
  101db0:	89 2c 24             	mov    %ebp,(%esp)
  101db3:	e8 18 fe ff ff       	call   101bd0 <dirlookup>
      iunlockput(ip);
  101db8:	89 2c 24             	mov    %ebp,(%esp)
    if(nameiparent && *path == '\0'){
      // Stop one level early.
      iunlock(ip);
      return ip;
    }
    if((next = dirlookup(ip, name, 0)) == 0){
  101dbb:	85 c0                	test   %eax,%eax
  101dbd:	89 c7                	mov    %eax,%edi
  101dbf:	74 5c                	je     101e1d <namex+0x14d>
      iunlockput(ip);
      return 0;
    }
    iunlockput(ip);
  101dc1:	e8 2a fb ff ff       	call   1018f0 <iunlockput>
    ip = next;
  101dc6:	89 fd                	mov    %edi,%ebp
  101dc8:	e9 36 ff ff ff       	jmp    101d03 <namex+0x33>
  while(*path == '/')
    path++;
  if(*path == 0)
    return 0;
  s = path;
  while(*path != '/' && *path != 0)
  101dcd:	31 d2                	xor    %edx,%edx
  101dcf:	90                   	nop
    path++;
  len = path - s;
  if(len >= DIRSIZ)
    memmove(name, s, DIRSIZ);
  else {
    memmove(name, s, len);
  101dd0:	89 54 24 08          	mov    %edx,0x8(%esp)
  101dd4:	89 5c 24 04          	mov    %ebx,0x4(%esp)
    name[len] = 0;
  101dd8:	89 fb                	mov    %edi,%ebx
    path++;
  len = path - s;
  if(len >= DIRSIZ)
    memmove(name, s, DIRSIZ);
  else {
    memmove(name, s, len);
  101dda:	89 54 24 18          	mov    %edx,0x18(%esp)
  101dde:	89 34 24             	mov    %esi,(%esp)
  101de1:	e8 1a 1f 00 00       	call   103d00 <memmove>
    name[len] = 0;
  101de6:	8b 54 24 18          	mov    0x18(%esp),%edx
  101dea:	c6 04 16 00          	movb   $0x0,(%esi,%edx,1)
  101dee:	e9 7a ff ff ff       	jmp    101d6d <namex+0x9d>
namex(char *path, int nameiparent, char *name)
{
  struct inode *ip, *next;

  if(*path == '/')
    ip = iget(ROOTDEV, ROOTINO);
  101df3:	ba 01 00 00 00       	mov    $0x1,%edx
  101df8:	b8 01 00 00 00       	mov    $0x1,%eax
  101dfd:	e8 4e f3 ff ff       	call   101150 <iget>
  101e02:	89 c5                	mov    %eax,%ebp
  101e04:	e9 fa fe ff ff       	jmp    101d03 <namex+0x33>
    ip = idup(proc->cwd);

  while((path = skipelem(path, name)) != 0){
    ilock(ip);
    if(ip->type != T_DIR){
      iunlockput(ip);
  101e09:	89 2c 24             	mov    %ebp,(%esp)
      return 0;
  101e0c:	31 ed                	xor    %ebp,%ebp
    ip = idup(proc->cwd);

  while((path = skipelem(path, name)) != 0){
    ilock(ip);
    if(ip->type != T_DIR){
      iunlockput(ip);
  101e0e:	e8 dd fa ff ff       	call   1018f0 <iunlockput>
  if(nameiparent){
    iput(ip);
    return 0;
  }
  return ip;
}
  101e13:	83 c4 2c             	add    $0x2c,%esp
  101e16:	89 e8                	mov    %ebp,%eax
  101e18:	5b                   	pop    %ebx
  101e19:	5e                   	pop    %esi
  101e1a:	5f                   	pop    %edi
  101e1b:	5d                   	pop    %ebp
  101e1c:	c3                   	ret    
      // Stop one level early.
      iunlock(ip);
      return ip;
    }
    if((next = dirlookup(ip, name, 0)) == 0){
      iunlockput(ip);
  101e1d:	e8 ce fa ff ff       	call   1018f0 <iunlockput>
      return 0;
  101e22:	31 ed                	xor    %ebp,%ebp
  if(nameiparent){
    iput(ip);
    return 0;
  }
  return ip;
}
  101e24:	83 c4 2c             	add    $0x2c,%esp
  101e27:	5b                   	pop    %ebx
  101e28:	89 e8                	mov    %ebp,%eax
  101e2a:	5e                   	pop    %esi
  101e2b:	5f                   	pop    %edi
  101e2c:	5d                   	pop    %ebp
  101e2d:	c3                   	ret    
      iunlockput(ip);
      return 0;
    }
    if(nameiparent && *path == '\0'){
      // Stop one level early.
      iunlock(ip);
  101e2e:	89 2c 24             	mov    %ebp,(%esp)
  101e31:	e8 1a f9 ff ff       	call   101750 <iunlock>
  if(nameiparent){
    iput(ip);
    return 0;
  }
  return ip;
}
  101e36:	83 c4 2c             	add    $0x2c,%esp
  101e39:	89 e8                	mov    %ebp,%eax
  101e3b:	5b                   	pop    %ebx
  101e3c:	5e                   	pop    %esi
  101e3d:	5f                   	pop    %edi
  101e3e:	5d                   	pop    %ebp
  101e3f:	c3                   	ret    
    }
    iunlockput(ip);
    ip = next;
  }
  if(nameiparent){
    iput(ip);
  101e40:	89 2c 24             	mov    %ebp,(%esp)
    return 0;
  101e43:	31 ed                	xor    %ebp,%ebp
    }
    iunlockput(ip);
    ip = next;
  }
  if(nameiparent){
    iput(ip);
  101e45:	e8 56 f9 ff ff       	call   1017a0 <iput>
    return 0;
  101e4a:	e9 cb fe ff ff       	jmp    101d1a <namex+0x4a>
  101e4f:	90                   	nop

00101e50 <dirlink>:
}

// Write a new directory entry (name, inum) into the directory dp.
int
dirlink(struct inode *dp, char *name, uint inum)
{
  101e50:	55                   	push   %ebp
  101e51:	57                   	push   %edi
  101e52:	56                   	push   %esi
  101e53:	53                   	push   %ebx
  101e54:	83 ec 2c             	sub    $0x2c,%esp
  101e57:	8b 74 24 40          	mov    0x40(%esp),%esi
  101e5b:	8b 6c 24 44          	mov    0x44(%esp),%ebp
  int off;
  struct dirent de;
  struct inode *ip;

  // Check that name is not present.
  if((ip = dirlookup(dp, name, 0)) != 0){
  101e5f:	c7 44 24 08 00 00 00 	movl   $0x0,0x8(%esp)
  101e66:	00 
  101e67:	89 34 24             	mov    %esi,(%esp)
  101e6a:	89 6c 24 04          	mov    %ebp,0x4(%esp)
  101e6e:	e8 5d fd ff ff       	call   101bd0 <dirlookup>
  101e73:	85 c0                	test   %eax,%eax
  101e75:	0f 85 8a 00 00 00    	jne    101f05 <dirlink+0xb5>
    iput(ip);
    return -1;
  }

  // Look for an empty dirent.
  for(off = 0; off < dp->size; off += sizeof(de)){
  101e7b:	8b 46 18             	mov    0x18(%esi),%eax
  101e7e:	31 db                	xor    %ebx,%ebx
  101e80:	8d 7c 24 10          	lea    0x10(%esp),%edi
  101e84:	85 c0                	test   %eax,%eax
  101e86:	75 10                	jne    101e98 <dirlink+0x48>
  101e88:	eb 33                	jmp    101ebd <dirlink+0x6d>
  101e8a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  101e90:	83 c3 10             	add    $0x10,%ebx
  101e93:	39 5e 18             	cmp    %ebx,0x18(%esi)
  101e96:	76 25                	jbe    101ebd <dirlink+0x6d>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
  101e98:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
  101e9f:	00 
  101ea0:	89 5c 24 08          	mov    %ebx,0x8(%esp)
  101ea4:	89 7c 24 04          	mov    %edi,0x4(%esp)
  101ea8:	89 34 24             	mov    %esi,(%esp)
  101eab:	e8 90 fa ff ff       	call   101940 <readi>
  101eb0:	83 f8 10             	cmp    $0x10,%eax
  101eb3:	75 5f                	jne    101f14 <dirlink+0xc4>
      panic("dirlink read");
    if(de.inum == 0)
  101eb5:	66 83 7c 24 10 00    	cmpw   $0x0,0x10(%esp)
  101ebb:	75 d3                	jne    101e90 <dirlink+0x40>
      break;
  }

  strncpy(de.name, name, DIRSIZ);
  101ebd:	8d 44 24 12          	lea    0x12(%esp),%eax
  101ec1:	c7 44 24 08 0e 00 00 	movl   $0xe,0x8(%esp)
  101ec8:	00 
  101ec9:	89 6c 24 04          	mov    %ebp,0x4(%esp)
  101ecd:	89 04 24             	mov    %eax,(%esp)
  101ed0:	e8 0b 1f 00 00       	call   103de0 <strncpy>
  de.inum = inum;
  101ed5:	8b 44 24 48          	mov    0x48(%esp),%eax
  if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
  101ed9:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
  101ee0:	00 
  101ee1:	89 5c 24 08          	mov    %ebx,0x8(%esp)
  101ee5:	89 7c 24 04          	mov    %edi,0x4(%esp)
    if(de.inum == 0)
      break;
  }

  strncpy(de.name, name, DIRSIZ);
  de.inum = inum;
  101ee9:	66 89 44 24 10       	mov    %ax,0x10(%esp)
  if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
  101eee:	89 34 24             	mov    %esi,(%esp)
  101ef1:	e8 5a fb ff ff       	call   101a50 <writei>
  101ef6:	83 f8 10             	cmp    $0x10,%eax
  101ef9:	75 25                	jne    101f20 <dirlink+0xd0>
    panic("dirlink");
  
  return 0;
  101efb:	31 c0                	xor    %eax,%eax
}
  101efd:	83 c4 2c             	add    $0x2c,%esp
  101f00:	5b                   	pop    %ebx
  101f01:	5e                   	pop    %esi
  101f02:	5f                   	pop    %edi
  101f03:	5d                   	pop    %ebp
  101f04:	c3                   	ret    
  struct dirent de;
  struct inode *ip;

  // Check that name is not present.
  if((ip = dirlookup(dp, name, 0)) != 0){
    iput(ip);
  101f05:	89 04 24             	mov    %eax,(%esp)
  101f08:	e8 93 f8 ff ff       	call   1017a0 <iput>
    return -1;
  101f0d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
  101f12:	eb e9                	jmp    101efd <dirlink+0xad>
  }

  // Look for an empty dirent.
  for(off = 0; off < dp->size; off += sizeof(de)){
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
      panic("dirlink read");
  101f14:	c7 04 24 e9 5d 10 00 	movl   $0x105de9,(%esp)
  101f1b:	e8 80 e8 ff ff       	call   1007a0 <panic>
  }

  strncpy(de.name, name, DIRSIZ);
  de.inum = inum;
  if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
    panic("dirlink");
  101f20:	c7 04 24 7a 63 10 00 	movl   $0x10637a,(%esp)
  101f27:	e8 74 e8 ff ff       	call   1007a0 <panic>
  101f2c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

00101f30 <namei>:
  return ip;
}

struct inode*
namei(char *path)
{
  101f30:	83 ec 1c             	sub    $0x1c,%esp
  char name[DIRSIZ];
  return namex(path, 0, name);
  101f33:	31 d2                	xor    %edx,%edx
  101f35:	8b 44 24 20          	mov    0x20(%esp),%eax
  101f39:	8d 4c 24 02          	lea    0x2(%esp),%ecx
  101f3d:	e8 8e fd ff ff       	call   101cd0 <namex>
}
  101f42:	83 c4 1c             	add    $0x1c,%esp
  101f45:	c3                   	ret    
  101f46:	8d 76 00             	lea    0x0(%esi),%esi
  101f49:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00101f50 <nameiparent>:

struct inode*
nameiparent(char *path, char *name)
{
  return namex(path, 1, name);
  101f50:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  101f54:	ba 01 00 00 00       	mov    $0x1,%edx
  101f59:	8b 44 24 04          	mov    0x4(%esp),%eax
  101f5d:	e9 6e fd ff ff       	jmp    101cd0 <namex>
  101f62:	90                   	nop
  101f63:	90                   	nop
  101f64:	90                   	nop
  101f65:	90                   	nop
  101f66:	90                   	nop
  101f67:	90                   	nop
  101f68:	90                   	nop
  101f69:	90                   	nop
  101f6a:	90                   	nop
  101f6b:	90                   	nop
  101f6c:	90                   	nop
  101f6d:	90                   	nop
  101f6e:	90                   	nop
  101f6f:	90                   	nop

00101f70 <idestart>:
}

// Start the request for b.  Caller must hold idelock.
static void
idestart(struct buf *b)
{
  101f70:	56                   	push   %esi
  101f71:	89 c1                	mov    %eax,%ecx
  101f73:	53                   	push   %ebx
  101f74:	83 ec 14             	sub    $0x14,%esp
  if(b == 0)
  101f77:	85 c0                	test   %eax,%eax
  101f79:	0f 84 8f 00 00 00    	je     10200e <idestart+0x9e>
static inline uchar
inb(ushort port)
{
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
  101f7f:	ba f7 01 00 00       	mov    $0x1f7,%edx
  101f84:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  101f88:	ec                   	in     (%dx),%al
static int
idewait(int checkerr)
{
  int r;

  while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) 
  101f89:	25 c0 00 00 00       	and    $0xc0,%eax
  101f8e:	83 f8 40             	cmp    $0x40,%eax
  101f91:	75 f5                	jne    101f88 <idestart+0x18>
}

static inline void
outb(ushort port, uchar data)
{
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
  101f93:	ba f6 03 00 00       	mov    $0x3f6,%edx
  101f98:	31 c0                	xor    %eax,%eax
  101f9a:	ee                   	out    %al,(%dx)
  101f9b:	ba f2 01 00 00       	mov    $0x1f2,%edx
  101fa0:	b8 01 00 00 00       	mov    $0x1,%eax
  101fa5:	ee                   	out    %al,(%dx)
    panic("idestart");

  idewait(0);
  outb(0x3f6, 0);  // generate interrupt
  outb(0x1f2, 1);  // number of sectors
  outb(0x1f3, b->sector & 0xff);
  101fa6:	8b 59 08             	mov    0x8(%ecx),%ebx
  101fa9:	b2 f3                	mov    $0xf3,%dl
  101fab:	89 d8                	mov    %ebx,%eax
  101fad:	ee                   	out    %al,(%dx)
  outb(0x1f4, (b->sector >> 8) & 0xff);
  101fae:	89 d8                	mov    %ebx,%eax
  101fb0:	b2 f4                	mov    $0xf4,%dl
  101fb2:	c1 e8 08             	shr    $0x8,%eax
  101fb5:	ee                   	out    %al,(%dx)
  outb(0x1f5, (b->sector >> 16) & 0xff);
  101fb6:	89 d8                	mov    %ebx,%eax
  101fb8:	b2 f5                	mov    $0xf5,%dl
  101fba:	c1 e8 10             	shr    $0x10,%eax
  101fbd:	ee                   	out    %al,(%dx)
  outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((b->sector>>24)&0x0f));
  101fbe:	8b 41 04             	mov    0x4(%ecx),%eax
  101fc1:	c1 eb 18             	shr    $0x18,%ebx
  101fc4:	b2 f6                	mov    $0xf6,%dl
  101fc6:	83 e3 0f             	and    $0xf,%ebx
  101fc9:	83 e0 01             	and    $0x1,%eax
  101fcc:	c1 e0 04             	shl    $0x4,%eax
  101fcf:	09 d8                	or     %ebx,%eax
  101fd1:	83 c8 e0             	or     $0xffffffe0,%eax
  101fd4:	ee                   	out    %al,(%dx)
  if(b->flags & B_DIRTY){
  101fd5:	f6 01 04             	testb  $0x4,(%ecx)
  101fd8:	75 16                	jne    101ff0 <idestart+0x80>
  101fda:	ba f7 01 00 00       	mov    $0x1f7,%edx
  101fdf:	b8 20 00 00 00       	mov    $0x20,%eax
  101fe4:	ee                   	out    %al,(%dx)
    outb(0x1f7, IDE_CMD_WRITE);
    outsl(0x1f0, b->data, 512/4);
  } else {
    outb(0x1f7, IDE_CMD_READ);
  }
}
  101fe5:	83 c4 14             	add    $0x14,%esp
  101fe8:	5b                   	pop    %ebx
  101fe9:	5e                   	pop    %esi
  101fea:	c3                   	ret    
  101feb:	90                   	nop
  101fec:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  101ff0:	b2 f7                	mov    $0xf7,%dl
  101ff2:	b8 30 00 00 00       	mov    $0x30,%eax
  101ff7:	ee                   	out    %al,(%dx)
}

static inline void
outsl(int port, const void *addr, int cnt)
{
  asm volatile("cld; rep outsl" :
  101ff8:	ba f0 01 00 00       	mov    $0x1f0,%edx
  outb(0x1f4, (b->sector >> 8) & 0xff);
  outb(0x1f5, (b->sector >> 16) & 0xff);
  outb(0x1f6, 0xe0 | ((b->dev&1)<<4) | ((b->sector>>24)&0x0f));
  if(b->flags & B_DIRTY){
    outb(0x1f7, IDE_CMD_WRITE);
    outsl(0x1f0, b->data, 512/4);
  101ffd:	8d 71 18             	lea    0x18(%ecx),%esi
  102000:	b9 80 00 00 00       	mov    $0x80,%ecx
  102005:	fc                   	cld    
  102006:	f3 6f                	rep outsl %ds:(%esi),(%dx)
  } else {
    outb(0x1f7, IDE_CMD_READ);
  }
}
  102008:	83 c4 14             	add    $0x14,%esp
  10200b:	5b                   	pop    %ebx
  10200c:	5e                   	pop    %esi
  10200d:	c3                   	ret    
// Start the request for b.  Caller must hold idelock.
static void
idestart(struct buf *b)
{
  if(b == 0)
    panic("idestart");
  10200e:	c7 04 24 f6 5d 10 00 	movl   $0x105df6,(%esp)
  102015:	e8 86 e7 ff ff       	call   1007a0 <panic>
  10201a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi

00102020 <ideinit>:
  return 0;
}

void
ideinit(void)
{
  102020:	83 ec 1c             	sub    $0x1c,%esp
  int i;

  initlock(&idelock, "ide");
  102023:	c7 44 24 04 ff 5d 10 	movl   $0x105dff,0x4(%esp)
  10202a:	00 
  10202b:	c7 04 24 e0 87 10 00 	movl   $0x1087e0,(%esp)
  102032:	e8 79 1a 00 00       	call   103ab0 <initlock>
  picenable(IRQ_IDE);
  102037:	c7 04 24 0e 00 00 00 	movl   $0xe,(%esp)
  10203e:	e8 ad 0a 00 00       	call   102af0 <picenable>
  ioapicenable(IRQ_IDE, ncpu - 1);
  102043:	a1 60 c0 10 00       	mov    0x10c060,%eax
  102048:	c7 04 24 0e 00 00 00 	movl   $0xe,(%esp)
  10204f:	83 e8 01             	sub    $0x1,%eax
  102052:	89 44 24 04          	mov    %eax,0x4(%esp)
  102056:	e8 75 02 00 00       	call   1022d0 <ioapicenable>
static inline uchar
inb(ushort port)
{
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
  10205b:	ba f7 01 00 00       	mov    $0x1f7,%edx
  102060:	ec                   	in     (%dx),%al
static int
idewait(int checkerr)
{
  int r;

  while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) 
  102061:	25 c0 00 00 00       	and    $0xc0,%eax
  102066:	83 f8 40             	cmp    $0x40,%eax
  102069:	75 f5                	jne    102060 <ideinit+0x40>
}

static inline void
outb(ushort port, uchar data)
{
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
  10206b:	ba f6 01 00 00       	mov    $0x1f6,%edx
  102070:	b8 f0 ff ff ff       	mov    $0xfffffff0,%eax
  102075:	ee                   	out    %al,(%dx)
  102076:	b9 e8 03 00 00       	mov    $0x3e8,%ecx
static inline uchar
inb(ushort port)
{
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
  10207b:	b2 f7                	mov    $0xf7,%dl
  10207d:	eb 06                	jmp    102085 <ideinit+0x65>
  10207f:	90                   	nop
  ioapicenable(IRQ_IDE, ncpu - 1);
  idewait(0);
  
  // Check if disk 1 is present
  outb(0x1f6, 0xe0 | (1<<4));
  for(i=0; i<1000; i++){
  102080:	83 e9 01             	sub    $0x1,%ecx
  102083:	74 0f                	je     102094 <ideinit+0x74>
  102085:	ec                   	in     (%dx),%al
    if(inb(0x1f7) != 0){
  102086:	84 c0                	test   %al,%al
  102088:	74 f6                	je     102080 <ideinit+0x60>
      havedisk1 = 1;
  10208a:	c7 05 14 88 10 00 01 	movl   $0x1,0x108814
  102091:	00 00 00 
}

static inline void
outb(ushort port, uchar data)
{
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
  102094:	ba f6 01 00 00       	mov    $0x1f6,%edx
  102099:	b8 e0 ff ff ff       	mov    $0xffffffe0,%eax
  10209e:	ee                   	out    %al,(%dx)
    }
  }
  
  // Switch back to disk 0.
  outb(0x1f6, 0xe0 | (0<<4));
}
  10209f:	83 c4 1c             	add    $0x1c,%esp
  1020a2:	c3                   	ret    
  1020a3:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  1020a9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

001020b0 <ideintr>:
}

// Interrupt handler.
void
ideintr(void)
{
  1020b0:	57                   	push   %edi
  1020b1:	53                   	push   %ebx
  1020b2:	83 ec 14             	sub    $0x14,%esp
  struct buf *b;

  // Take first buffer off queue.
  acquire(&idelock);
  1020b5:	c7 04 24 e0 87 10 00 	movl   $0x1087e0,(%esp)
  1020bc:	e8 af 1a 00 00       	call   103b70 <acquire>
  if((b = idequeue) == 0){
  1020c1:	8b 1d 18 88 10 00    	mov    0x108818,%ebx
  1020c7:	85 db                	test   %ebx,%ebx
  1020c9:	74 76                	je     102141 <ideintr+0x91>
    release(&idelock);
    cprintf("Spurious IDE interrupt.\n");
    return;
  }
  idequeue = b->qnext;
  1020cb:	8b 43 14             	mov    0x14(%ebx),%eax
  1020ce:	a3 18 88 10 00       	mov    %eax,0x108818

  // Read data if needed.
  if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
  1020d3:	8b 0b                	mov    (%ebx),%ecx
  1020d5:	f6 c1 04             	test   $0x4,%cl
  1020d8:	74 36                	je     102110 <ideintr+0x60>
    insl(0x1f0, b->data, 512/4);
  
  // Wake process waiting for this buf.
  b->flags |= B_VALID;
  1020da:	83 c9 02             	or     $0x2,%ecx
  b->flags &= ~B_DIRTY;
  1020dd:	83 e1 fb             	and    $0xfffffffb,%ecx
  1020e0:	89 0b                	mov    %ecx,(%ebx)
  wakeup(b);
  1020e2:	89 1c 24             	mov    %ebx,(%esp)
  1020e5:	e8 d6 16 00 00       	call   1037c0 <wakeup>
  
  // Start disk on next buf in queue.
  if(idequeue != 0)
  1020ea:	a1 18 88 10 00       	mov    0x108818,%eax
  1020ef:	85 c0                	test   %eax,%eax
  1020f1:	74 05                	je     1020f8 <ideintr+0x48>
    idestart(idequeue);
  1020f3:	e8 78 fe ff ff       	call   101f70 <idestart>

  release(&idelock);
  1020f8:	c7 04 24 e0 87 10 00 	movl   $0x1087e0,(%esp)
  1020ff:	e8 2c 1b 00 00       	call   103c30 <release>
}
  102104:	83 c4 14             	add    $0x14,%esp
  102107:	5b                   	pop    %ebx
  102108:	5f                   	pop    %edi
  102109:	c3                   	ret    
  10210a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
static inline uchar
inb(ushort port)
{
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
  102110:	ba f7 01 00 00       	mov    $0x1f7,%edx
  102115:	8d 76 00             	lea    0x0(%esi),%esi
  102118:	ec                   	in     (%dx),%al
static int
idewait(int checkerr)
{
  int r;

  while(((r = inb(0x1f7)) & (IDE_BSY|IDE_DRDY)) != IDE_DRDY) 
  102119:	0f b6 c0             	movzbl %al,%eax
  10211c:	89 c7                	mov    %eax,%edi
  10211e:	81 e7 c0 00 00 00    	and    $0xc0,%edi
  102124:	83 ff 40             	cmp    $0x40,%edi
  102127:	75 ef                	jne    102118 <ideintr+0x68>
    ;
  if(checkerr && (r & (IDE_DF|IDE_ERR)) != 0)
  102129:	a8 21                	test   $0x21,%al
  10212b:	75 ad                	jne    1020da <ideintr+0x2a>
  }
  idequeue = b->qnext;

  // Read data if needed.
  if(!(b->flags & B_DIRTY) && idewait(1) >= 0)
    insl(0x1f0, b->data, 512/4);
  10212d:	8d 7b 18             	lea    0x18(%ebx),%edi
}

static inline void
insl(int port, void *addr, int cnt)
{
  asm volatile("cld; rep insl" :
  102130:	b9 80 00 00 00       	mov    $0x80,%ecx
  102135:	ba f0 01 00 00       	mov    $0x1f0,%edx
  10213a:	fc                   	cld    
  10213b:	f3 6d                	rep insl (%dx),%es:(%edi)
  10213d:	8b 0b                	mov    (%ebx),%ecx
  10213f:	eb 99                	jmp    1020da <ideintr+0x2a>
  struct buf *b;

  // Take first buffer off queue.
  acquire(&idelock);
  if((b = idequeue) == 0){
    release(&idelock);
  102141:	c7 04 24 e0 87 10 00 	movl   $0x1087e0,(%esp)
  102148:	e8 e3 1a 00 00       	call   103c30 <release>
    cprintf("Spurious IDE interrupt.\n");
  10214d:	c7 04 24 03 5e 10 00 	movl   $0x105e03,(%esp)
  102154:	e8 f7 e4 ff ff       	call   100650 <cprintf>
    return;
  102159:	eb a9                	jmp    102104 <ideintr+0x54>
  10215b:	90                   	nop
  10215c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

00102160 <iderw>:
// Sync buf with disk. 
// If B_DIRTY is set, write buf to disk, clear B_DIRTY, set B_VALID.
// Else if B_VALID is not set, read buf from disk, set B_VALID.
void
iderw(struct buf *b)
{
  102160:	53                   	push   %ebx
  102161:	83 ec 18             	sub    $0x18,%esp
  102164:	8b 5c 24 20          	mov    0x20(%esp),%ebx
  struct buf **pp;

  if(!(b->flags & B_BUSY))
  102168:	8b 03                	mov    (%ebx),%eax
  10216a:	a8 01                	test   $0x1,%al
  10216c:	0f 84 8a 00 00 00    	je     1021fc <iderw+0x9c>
    panic("iderw: buf not busy");
  if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
  102172:	83 e0 06             	and    $0x6,%eax
  102175:	83 f8 02             	cmp    $0x2,%eax
  102178:	0f 84 96 00 00 00    	je     102214 <iderw+0xb4>
    panic("iderw: nothing to do");
  if(b->dev != 0 && !havedisk1)
  10217e:	8b 53 04             	mov    0x4(%ebx),%edx
  102181:	85 d2                	test   %edx,%edx
  102183:	74 09                	je     10218e <iderw+0x2e>
  102185:	a1 14 88 10 00       	mov    0x108814,%eax
  10218a:	85 c0                	test   %eax,%eax
  10218c:	74 7a                	je     102208 <iderw+0xa8>
    panic("idrw: ide disk 1 not present");

  acquire(&idelock);
  10218e:	c7 04 24 e0 87 10 00 	movl   $0x1087e0,(%esp)
  102195:	e8 d6 19 00 00       	call   103b70 <acquire>

  // Append b to idequeue.
  b->qnext = 0;
  for(pp=&idequeue; *pp; pp=&(*pp)->qnext)
  10219a:	a1 18 88 10 00       	mov    0x108818,%eax
  10219f:	ba 18 88 10 00       	mov    $0x108818,%edx
    panic("idrw: ide disk 1 not present");

  acquire(&idelock);

  // Append b to idequeue.
  b->qnext = 0;
  1021a4:	c7 43 14 00 00 00 00 	movl   $0x0,0x14(%ebx)
  for(pp=&idequeue; *pp; pp=&(*pp)->qnext)
  1021ab:	85 c0                	test   %eax,%eax
  1021ad:	74 0b                	je     1021ba <iderw+0x5a>
  1021af:	90                   	nop
  1021b0:	8d 50 14             	lea    0x14(%eax),%edx
  1021b3:	8b 40 14             	mov    0x14(%eax),%eax
  1021b6:	85 c0                	test   %eax,%eax
  1021b8:	75 f6                	jne    1021b0 <iderw+0x50>
    ;
  *pp = b;
  1021ba:	89 1a                	mov    %ebx,(%edx)
  
  // Start disk if necessary.
  if(idequeue == b)
  1021bc:	39 1d 18 88 10 00    	cmp    %ebx,0x108818
  1021c2:	75 14                	jne    1021d8 <iderw+0x78>
  1021c4:	eb 2d                	jmp    1021f3 <iderw+0x93>
  1021c6:	66 90                	xchg   %ax,%ax
    idestart(b);
  
  // Wait for request to finish.
  // Assuming will not sleep too long: ignore proc->killed.
  while((b->flags & (B_VALID|B_DIRTY)) != B_VALID)
    sleep(b, &idelock);
  1021c8:	c7 44 24 04 e0 87 10 	movl   $0x1087e0,0x4(%esp)
  1021cf:	00 
  1021d0:	89 1c 24             	mov    %ebx,(%esp)
  1021d3:	e8 28 15 00 00       	call   103700 <sleep>
  if(idequeue == b)
    idestart(b);
  
  // Wait for request to finish.
  // Assuming will not sleep too long: ignore proc->killed.
  while((b->flags & (B_VALID|B_DIRTY)) != B_VALID)
  1021d8:	8b 03                	mov    (%ebx),%eax
  1021da:	83 e0 06             	and    $0x6,%eax
  1021dd:	83 f8 02             	cmp    $0x2,%eax
  1021e0:	75 e6                	jne    1021c8 <iderw+0x68>
    sleep(b, &idelock);

  release(&idelock);
  1021e2:	c7 44 24 20 e0 87 10 	movl   $0x1087e0,0x20(%esp)
  1021e9:	00 
}
  1021ea:	83 c4 18             	add    $0x18,%esp
  1021ed:	5b                   	pop    %ebx
  // Wait for request to finish.
  // Assuming will not sleep too long: ignore proc->killed.
  while((b->flags & (B_VALID|B_DIRTY)) != B_VALID)
    sleep(b, &idelock);

  release(&idelock);
  1021ee:	e9 3d 1a 00 00       	jmp    103c30 <release>
    ;
  *pp = b;
  
  // Start disk if necessary.
  if(idequeue == b)
    idestart(b);
  1021f3:	89 d8                	mov    %ebx,%eax
  1021f5:	e8 76 fd ff ff       	call   101f70 <idestart>
  1021fa:	eb dc                	jmp    1021d8 <iderw+0x78>
iderw(struct buf *b)
{
  struct buf **pp;

  if(!(b->flags & B_BUSY))
    panic("iderw: buf not busy");
  1021fc:	c7 04 24 1c 5e 10 00 	movl   $0x105e1c,(%esp)
  102203:	e8 98 e5 ff ff       	call   1007a0 <panic>
  if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
    panic("iderw: nothing to do");
  if(b->dev != 0 && !havedisk1)
    panic("idrw: ide disk 1 not present");
  102208:	c7 04 24 45 5e 10 00 	movl   $0x105e45,(%esp)
  10220f:	e8 8c e5 ff ff       	call   1007a0 <panic>
  struct buf **pp;

  if(!(b->flags & B_BUSY))
    panic("iderw: buf not busy");
  if((b->flags & (B_VALID|B_DIRTY)) == B_VALID)
    panic("iderw: nothing to do");
  102214:	c7 04 24 30 5e 10 00 	movl   $0x105e30,(%esp)
  10221b:	e8 80 e5 ff ff       	call   1007a0 <panic>

00102220 <ioapicinit>:
  ioapic->data = data;
}

void
ioapicinit(void)
{
  102220:	56                   	push   %esi
  102221:	53                   	push   %ebx
  102222:	83 ec 14             	sub    $0x14,%esp
  int i, id, maxintr;

  if(!ismp)
  102225:	a1 64 ba 10 00       	mov    0x10ba64,%eax
  10222a:	85 c0                	test   %eax,%eax
  10222c:	0f 84 8e 00 00 00    	je     1022c0 <ioapicinit+0xa0>
};

static uint
ioapicread(int reg)
{
  ioapic->reg = reg;
  102232:	c7 05 00 00 c0 fe 01 	movl   $0x1,0xfec00000
  102239:	00 00 00 
  return ioapic->data;
  10223c:	8b 35 10 00 c0 fe    	mov    0xfec00010,%esi
  102242:	bb 00 00 c0 fe       	mov    $0xfec00000,%ebx
};

static uint
ioapicread(int reg)
{
  ioapic->reg = reg;
  102247:	c7 05 00 00 c0 fe 00 	movl   $0x0,0xfec00000
  10224e:	00 00 00 
  return ioapic->data;
  102251:	a1 10 00 c0 fe       	mov    0xfec00010,%eax
    return;

  ioapic = (volatile struct ioapic*)IOAPIC;
  maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
  id = ioapicread(REG_ID) >> 24;
  if(id != ioapicid)
  102256:	0f b6 15 60 ba 10 00 	movzbl 0x10ba60,%edx
  int i, id, maxintr;

  if(!ismp)
    return;

  ioapic = (volatile struct ioapic*)IOAPIC;
  10225d:	c7 05 14 ba 10 00 00 	movl   $0xfec00000,0x10ba14
  102264:	00 c0 fe 
  maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
  102267:	c1 ee 10             	shr    $0x10,%esi
  id = ioapicread(REG_ID) >> 24;
  10226a:	c1 e8 18             	shr    $0x18,%eax

  if(!ismp)
    return;

  ioapic = (volatile struct ioapic*)IOAPIC;
  maxintr = (ioapicread(REG_VER) >> 16) & 0xFF;
  10226d:	81 e6 ff 00 00 00    	and    $0xff,%esi
  id = ioapicread(REG_ID) >> 24;
  if(id != ioapicid)
  102273:	39 c2                	cmp    %eax,%edx
  102275:	74 12                	je     102289 <ioapicinit+0x69>
    cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");
  102277:	c7 04 24 64 5e 10 00 	movl   $0x105e64,(%esp)
  10227e:	e8 cd e3 ff ff       	call   100650 <cprintf>
  102283:	8b 1d 14 ba 10 00    	mov    0x10ba14,%ebx
  ioapic->data = data;
}

void
ioapicinit(void)
{
  102289:	ba 10 00 00 00       	mov    $0x10,%edx
  10228e:	31 c0                	xor    %eax,%eax
}

static void
ioapicwrite(int reg, uint data)
{
  ioapic->reg = reg;
  102290:	89 13                	mov    %edx,(%ebx)
  ioapic->data = data;
  102292:	8b 1d 14 ba 10 00    	mov    0x10ba14,%ebx
}

void
ioapicinit(void)
  102298:	8d 48 20             	lea    0x20(%eax),%ecx
    cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");

  // Mark all interrupts edge-triggered, active high, disabled,
  // and not routed to any CPUs.
  for(i = 0; i <= maxintr; i++){
    ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
  10229b:	81 c9 00 00 01 00    	or     $0x10000,%ecx
  if(id != ioapicid)
    cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");

  // Mark all interrupts edge-triggered, active high, disabled,
  // and not routed to any CPUs.
  for(i = 0; i <= maxintr; i++){
  1022a1:	83 c0 01             	add    $0x1,%eax

static void
ioapicwrite(int reg, uint data)
{
  ioapic->reg = reg;
  ioapic->data = data;
  1022a4:	89 4b 10             	mov    %ecx,0x10(%ebx)
}

void
ioapicinit(void)
  1022a7:	8d 4a 01             	lea    0x1(%edx),%ecx
  if(id != ioapicid)
    cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");

  // Mark all interrupts edge-triggered, active high, disabled,
  // and not routed to any CPUs.
  for(i = 0; i <= maxintr; i++){
  1022aa:	83 c2 02             	add    $0x2,%edx
}

static void
ioapicwrite(int reg, uint data)
{
  ioapic->reg = reg;
  1022ad:	89 0b                	mov    %ecx,(%ebx)
  ioapic->data = data;
  1022af:	8b 1d 14 ba 10 00    	mov    0x10ba14,%ebx
  if(id != ioapicid)
    cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");

  // Mark all interrupts edge-triggered, active high, disabled,
  // and not routed to any CPUs.
  for(i = 0; i <= maxintr; i++){
  1022b5:	39 c6                	cmp    %eax,%esi

static void
ioapicwrite(int reg, uint data)
{
  ioapic->reg = reg;
  ioapic->data = data;
  1022b7:	c7 43 10 00 00 00 00 	movl   $0x0,0x10(%ebx)
  if(id != ioapicid)
    cprintf("ioapicinit: id isn't equal to ioapicid; not a MP\n");

  // Mark all interrupts edge-triggered, active high, disabled,
  // and not routed to any CPUs.
  for(i = 0; i <= maxintr; i++){
  1022be:	7d d0                	jge    102290 <ioapicinit+0x70>
    ioapicwrite(REG_TABLE+2*i, INT_DISABLED | (T_IRQ0 + i));
    ioapicwrite(REG_TABLE+2*i+1, 0);
  }
}
  1022c0:	83 c4 14             	add    $0x14,%esp
  1022c3:	5b                   	pop    %ebx
  1022c4:	5e                   	pop    %esi
  1022c5:	c3                   	ret    
  1022c6:	8d 76 00             	lea    0x0(%esi),%esi
  1022c9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

001022d0 <ioapicenable>:

void
ioapicenable(int irq, int cpunum)
{
  if(!ismp)
  1022d0:	8b 15 64 ba 10 00    	mov    0x10ba64,%edx
  }
}

void
ioapicenable(int irq, int cpunum)
{
  1022d6:	8b 44 24 04          	mov    0x4(%esp),%eax
  if(!ismp)
  1022da:	85 d2                	test   %edx,%edx
  1022dc:	74 2a                	je     102308 <ioapicenable+0x38>
    return;

  // Mark interrupt edge-triggered, active high,
  // enabled, and routed to the given cpunum,
  // which happens to be that cpu's APIC ID.
  ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
  1022de:	8d 48 20             	lea    0x20(%eax),%ecx
  1022e1:	8d 54 00 10          	lea    0x10(%eax,%eax,1),%edx
}

static void
ioapicwrite(int reg, uint data)
{
  ioapic->reg = reg;
  1022e5:	a1 14 ba 10 00       	mov    0x10ba14,%eax
  1022ea:	89 10                	mov    %edx,(%eax)
  ioapic->data = data;
  1022ec:	a1 14 ba 10 00       	mov    0x10ba14,%eax

  // Mark interrupt edge-triggered, active high,
  // enabled, and routed to the given cpunum,
  // which happens to be that cpu's APIC ID.
  ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
  ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
  1022f1:	83 c2 01             	add    $0x1,%edx

static void
ioapicwrite(int reg, uint data)
{
  ioapic->reg = reg;
  ioapic->data = data;
  1022f4:	89 48 10             	mov    %ecx,0x10(%eax)

  // Mark interrupt edge-triggered, active high,
  // enabled, and routed to the given cpunum,
  // which happens to be that cpu's APIC ID.
  ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
  ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
  1022f7:	8b 4c 24 08          	mov    0x8(%esp),%ecx
}

static void
ioapicwrite(int reg, uint data)
{
  ioapic->reg = reg;
  1022fb:	89 10                	mov    %edx,(%eax)
  ioapic->data = data;
  1022fd:	a1 14 ba 10 00       	mov    0x10ba14,%eax

  // Mark interrupt edge-triggered, active high,
  // enabled, and routed to the given cpunum,
  // which happens to be that cpu's APIC ID.
  ioapicwrite(REG_TABLE+2*irq, T_IRQ0 + irq);
  ioapicwrite(REG_TABLE+2*irq+1, cpunum << 24);
  102302:	c1 e1 18             	shl    $0x18,%ecx

static void
ioapicwrite(int reg, uint data)
{
  ioapic->reg = reg;
  ioapic->data = data;
  102305:	89 48 10             	mov    %ecx,0x10(%eax)
  102308:	f3 c3                	repz ret 
  10230a:	90                   	nop
  10230b:	90                   	nop
  10230c:	90                   	nop
  10230d:	90                   	nop
  10230e:	90                   	nop
  10230f:	90                   	nop

00102310 <kfree>:
// which normally should have been returned by a
// call to kalloc(len).  (The exception is when
// initializing the allocator; see kinit above.)
void
kfree(char *v, int len)
{
  102310:	55                   	push   %ebp
  102311:	57                   	push   %edi
  102312:	56                   	push   %esi
  102313:	53                   	push   %ebx
  102314:	83 ec 1c             	sub    $0x1c,%esp
  102317:	8b 74 24 34          	mov    0x34(%esp),%esi
  10231b:	8b 5c 24 30          	mov    0x30(%esp),%ebx
  struct run *r, *rend, **rp, *p, *pend;

  if(len <= 0 || len % PAGE)
  10231f:	85 f6                	test   %esi,%esi
  102321:	0f 8e e6 00 00 00    	jle    10240d <kfree+0xfd>
  102327:	f7 c6 ff 0f 00 00    	test   $0xfff,%esi
  10232d:	0f 85 da 00 00 00    	jne    10240d <kfree+0xfd>
    panic("kfree");

  // Fill with junk to catch dangling refs.
  memset(v, 1, len);
  102333:	89 74 24 08          	mov    %esi,0x8(%esp)
  102337:	c7 44 24 04 01 00 00 	movl   $0x1,0x4(%esp)
  10233e:	00 
  10233f:	89 1c 24             	mov    %ebx,(%esp)
  102342:	e8 39 19 00 00       	call   103c80 <memset>

  acquire(&kmem.lock);
  102347:	c7 04 24 20 ba 10 00 	movl   $0x10ba20,(%esp)
  10234e:	e8 1d 18 00 00       	call   103b70 <acquire>
  p = (struct run*)v;
  pend = (struct run*)(v + len);
  for(rp=&kmem.freelist; (r=*rp) != 0 && r <= pend; rp=&r->next){
  102353:	a1 54 ba 10 00       	mov    0x10ba54,%eax
  102358:	85 c0                	test   %eax,%eax
  10235a:	0f 84 96 00 00 00    	je     1023f6 <kfree+0xe6>
  // Fill with junk to catch dangling refs.
  memset(v, 1, len);

  acquire(&kmem.lock);
  p = (struct run*)v;
  pend = (struct run*)(v + len);
  102360:	8d 0c 33             	lea    (%ebx,%esi,1),%ecx
  for(rp=&kmem.freelist; (r=*rp) != 0 && r <= pend; rp=&r->next){
  102363:	39 c1                	cmp    %eax,%ecx
  102365:	0f 82 8b 00 00 00    	jb     1023f6 <kfree+0xe6>
    rend = (struct run*)((char*)r + r->len);
  10236b:	8b 78 04             	mov    0x4(%eax),%edi
    if(r <= p && p < rend)
  10236e:	39 c3                	cmp    %eax,%ebx

  acquire(&kmem.lock);
  p = (struct run*)v;
  pend = (struct run*)(v + len);
  for(rp=&kmem.freelist; (r=*rp) != 0 && r <= pend; rp=&r->next){
    rend = (struct run*)((char*)r + r->len);
  102370:	8d 14 38             	lea    (%eax,%edi,1),%edx
    if(r <= p && p < rend)
  102373:	0f 83 a0 00 00 00    	jae    102419 <kfree+0x109>
      panic("freeing free page");
    if(rend == p){  // r before p: expand r to include p
  102379:	39 d3                	cmp    %edx,%ebx
  10237b:	74 4b                	je     1023c8 <kfree+0xb8>
        r->len += r->next->len;
        r->next = r->next->next;
      }
      goto out;
    }
    if(pend == r){  // p before r: expand p to include, replace r
  10237d:	39 c1                	cmp    %eax,%ecx
  10237f:	75 23                	jne    1023a4 <kfree+0x94>
  102381:	eb 60                	jmp    1023e3 <kfree+0xd3>
  102383:	90                   	nop
  102384:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  memset(v, 1, len);

  acquire(&kmem.lock);
  p = (struct run*)v;
  pend = (struct run*)(v + len);
  for(rp=&kmem.freelist; (r=*rp) != 0 && r <= pend; rp=&r->next){
  102388:	39 c1                	cmp    %eax,%ecx
  10238a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  102390:	72 1a                	jb     1023ac <kfree+0x9c>
    rend = (struct run*)((char*)r + r->len);
  102392:	8b 78 04             	mov    0x4(%eax),%edi
  102395:	8d 14 38             	lea    (%eax,%edi,1),%edx
    if(r <= p && p < rend)
  102398:	39 d3                	cmp    %edx,%ebx
  10239a:	72 61                	jb     1023fd <kfree+0xed>
      panic("freeing free page");
    if(rend == p){  // r before p: expand r to include p
  10239c:	39 d3                	cmp    %edx,%ebx
  10239e:	74 28                	je     1023c8 <kfree+0xb8>
        r->len += r->next->len;
        r->next = r->next->next;
      }
      goto out;
    }
    if(pend == r){  // p before r: expand p to include, replace r
  1023a0:	39 c1                	cmp    %eax,%ecx
  1023a2:	74 44                	je     1023e8 <kfree+0xd8>
  memset(v, 1, len);

  acquire(&kmem.lock);
  p = (struct run*)v;
  pend = (struct run*)(v + len);
  for(rp=&kmem.freelist; (r=*rp) != 0 && r <= pend; rp=&r->next){
  1023a4:	89 c5                	mov    %eax,%ebp
  1023a6:	8b 00                	mov    (%eax),%eax
  1023a8:	85 c0                	test   %eax,%eax
  1023aa:	75 dc                	jne    102388 <kfree+0x78>
      *rp = p;
      goto out;
    }
  }
  // Insert p before r in list.
  p->len = len;
  1023ac:	89 73 04             	mov    %esi,0x4(%ebx)
  p->next = r;
  1023af:	89 03                	mov    %eax,(%ebx)
  *rp = p;
  1023b1:	89 5d 00             	mov    %ebx,0x0(%ebp)

 out:
  release(&kmem.lock);
  1023b4:	c7 44 24 30 20 ba 10 	movl   $0x10ba20,0x30(%esp)
  1023bb:	00 
}
  1023bc:	83 c4 1c             	add    $0x1c,%esp
  1023bf:	5b                   	pop    %ebx
  1023c0:	5e                   	pop    %esi
  1023c1:	5f                   	pop    %edi
  1023c2:	5d                   	pop    %ebp
  p->len = len;
  p->next = r;
  *rp = p;

 out:
  release(&kmem.lock);
  1023c3:	e9 68 18 00 00       	jmp    103c30 <release>
    rend = (struct run*)((char*)r + r->len);
    if(r <= p && p < rend)
      panic("freeing free page");
    if(rend == p){  // r before p: expand r to include p
      r->len += len;
      if(r->next && r->next == pend){  // r now next to r->next?
  1023c8:	8b 10                	mov    (%eax),%edx
  for(rp=&kmem.freelist; (r=*rp) != 0 && r <= pend; rp=&r->next){
    rend = (struct run*)((char*)r + r->len);
    if(r <= p && p < rend)
      panic("freeing free page");
    if(rend == p){  // r before p: expand r to include p
      r->len += len;
  1023ca:	01 fe                	add    %edi,%esi
  1023cc:	89 70 04             	mov    %esi,0x4(%eax)
      if(r->next && r->next == pend){  // r now next to r->next?
  1023cf:	85 d2                	test   %edx,%edx
  1023d1:	74 e1                	je     1023b4 <kfree+0xa4>
  1023d3:	39 d1                	cmp    %edx,%ecx
  1023d5:	75 dd                	jne    1023b4 <kfree+0xa4>
        r->len += r->next->len;
  1023d7:	03 71 04             	add    0x4(%ecx),%esi
  1023da:	89 70 04             	mov    %esi,0x4(%eax)
        r->next = r->next->next;
  1023dd:	8b 11                	mov    (%ecx),%edx
  1023df:	89 10                	mov    %edx,(%eax)
  1023e1:	eb d1                	jmp    1023b4 <kfree+0xa4>
  memset(v, 1, len);

  acquire(&kmem.lock);
  p = (struct run*)v;
  pend = (struct run*)(v + len);
  for(rp=&kmem.freelist; (r=*rp) != 0 && r <= pend; rp=&r->next){
  1023e3:	bd 54 ba 10 00       	mov    $0x10ba54,%ebp
        r->next = r->next->next;
      }
      goto out;
    }
    if(pend == r){  // p before r: expand p to include, replace r
      p->len = len + r->len;
  1023e8:	01 fe                	add    %edi,%esi
  1023ea:	89 73 04             	mov    %esi,0x4(%ebx)
      p->next = r->next;
  1023ed:	8b 00                	mov    (%eax),%eax
  1023ef:	89 03                	mov    %eax,(%ebx)
      *rp = p;
  1023f1:	89 5d 00             	mov    %ebx,0x0(%ebp)
      goto out;
  1023f4:	eb be                	jmp    1023b4 <kfree+0xa4>
  memset(v, 1, len);

  acquire(&kmem.lock);
  p = (struct run*)v;
  pend = (struct run*)(v + len);
  for(rp=&kmem.freelist; (r=*rp) != 0 && r <= pend; rp=&r->next){
  1023f6:	bd 54 ba 10 00       	mov    $0x10ba54,%ebp
  1023fb:	eb af                	jmp    1023ac <kfree+0x9c>
    rend = (struct run*)((char*)r + r->len);
    if(r <= p && p < rend)
  1023fd:	39 c3                	cmp    %eax,%ebx
  1023ff:	72 9b                	jb     10239c <kfree+0x8c>
      panic("freeing free page");
  102401:	c7 04 24 9c 5e 10 00 	movl   $0x105e9c,(%esp)
  102408:	e8 93 e3 ff ff       	call   1007a0 <panic>
kfree(char *v, int len)
{
  struct run *r, *rend, **rp, *p, *pend;

  if(len <= 0 || len % PAGE)
    panic("kfree");
  10240d:	c7 04 24 96 5e 10 00 	movl   $0x105e96,(%esp)
  102414:	e8 87 e3 ff ff       	call   1007a0 <panic>
  acquire(&kmem.lock);
  p = (struct run*)v;
  pend = (struct run*)(v + len);
  for(rp=&kmem.freelist; (r=*rp) != 0 && r <= pend; rp=&r->next){
    rend = (struct run*)((char*)r + r->len);
    if(r <= p && p < rend)
  102419:	39 d3                	cmp    %edx,%ebx
  10241b:	0f 83 58 ff ff ff    	jae    102379 <kfree+0x69>
  102421:	eb de                	jmp    102401 <kfree+0xf1>
  102423:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  102429:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00102430 <kinit>:
// This code cheats by just considering one megabyte of
// pages after end.  Real systems would determine the
// amount of memory available in the system and use it all.
void
kinit(void)
{
  102430:	83 ec 1c             	sub    $0x1c,%esp
  extern char end[];
  uint len;
  char *p;

  initlock(&kmem.lock, "kmem");
  102433:	c7 44 24 04 ae 5e 10 	movl   $0x105eae,0x4(%esp)
  10243a:	00 
  10243b:	c7 04 24 20 ba 10 00 	movl   $0x10ba20,(%esp)
  102442:	e8 69 16 00 00       	call   103ab0 <initlock>
  p = (char*)(((uint)end + PAGE) & ~(PAGE-1));
  len = 256*PAGE; // assume computer has 256 pages of RAM, 1 MB
  cprintf("mem = %d\n", len);
  102447:	c7 44 24 04 00 00 10 	movl   $0x100000,0x4(%esp)
  10244e:	00 
  10244f:	c7 04 24 b3 5e 10 00 	movl   $0x105eb3,(%esp)
  102456:	e8 f5 e1 ff ff       	call   100650 <cprintf>
  extern char end[];
  uint len;
  char *p;

  initlock(&kmem.lock, "kmem");
  p = (char*)(((uint)end + PAGE) & ~(PAGE-1));
  10245b:	b8 04 f8 10 00       	mov    $0x10f804,%eax
  102460:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  len = 256*PAGE; // assume computer has 256 pages of RAM, 1 MB
  cprintf("mem = %d\n", len);
  kfree(p, len);
  102465:	c7 44 24 04 00 00 10 	movl   $0x100000,0x4(%esp)
  10246c:	00 
  10246d:	89 04 24             	mov    %eax,(%esp)
  102470:	e8 9b fe ff ff       	call   102310 <kfree>
}
  102475:	83 c4 1c             	add    $0x1c,%esp
  102478:	c3                   	ret    
  102479:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi

00102480 <kalloc>:
// Allocate n bytes of physical memory.
// Returns a kernel-segment pointer.
// Returns 0 if the memory cannot be allocated.
char*
kalloc(int n)
{
  102480:	53                   	push   %ebx
  102481:	83 ec 18             	sub    $0x18,%esp
  102484:	8b 5c 24 20          	mov    0x20(%esp),%ebx
  char *p;
  struct run *r, **rp;

  if(n % PAGE || n <= 0)
  102488:	f7 c3 ff 0f 00 00    	test   $0xfff,%ebx
  10248e:	0f 85 7f 00 00 00    	jne    102513 <kalloc+0x93>
  102494:	85 db                	test   %ebx,%ebx
  102496:	7e 7b                	jle    102513 <kalloc+0x93>
    panic("kalloc");

  acquire(&kmem.lock);
  102498:	c7 04 24 20 ba 10 00 	movl   $0x10ba20,(%esp)
  10249f:	e8 cc 16 00 00       	call   103b70 <acquire>
  for(rp=&kmem.freelist; (r=*rp) != 0; rp=&r->next){
  1024a4:	8b 15 54 ba 10 00    	mov    0x10ba54,%edx
  1024aa:	85 d2                	test   %edx,%edx
  1024ac:	74 19                	je     1024c7 <kalloc+0x47>
    if(r->len >= n){
  1024ae:	8b 42 04             	mov    0x4(%edx),%eax
  1024b1:	39 c3                	cmp    %eax,%ebx
  1024b3:	7f 0a                	jg     1024bf <kalloc+0x3f>
  1024b5:	eb 31                	jmp    1024e8 <kalloc+0x68>
  1024b7:	90                   	nop
  1024b8:	8b 42 04             	mov    0x4(%edx),%eax
  1024bb:	39 c3                	cmp    %eax,%ebx
  1024bd:	7e 31                	jle    1024f0 <kalloc+0x70>

  if(n % PAGE || n <= 0)
    panic("kalloc");

  acquire(&kmem.lock);
  for(rp=&kmem.freelist; (r=*rp) != 0; rp=&r->next){
  1024bf:	89 d1                	mov    %edx,%ecx
  1024c1:	8b 12                	mov    (%edx),%edx
  1024c3:	85 d2                	test   %edx,%edx
  1024c5:	75 f1                	jne    1024b8 <kalloc+0x38>
        *rp = r->next;
      release(&kmem.lock);
      return p;
    }
  }
  release(&kmem.lock);
  1024c7:	c7 04 24 20 ba 10 00 	movl   $0x10ba20,(%esp)

  cprintf("kalloc: out of memory\n");
  return 0;
  1024ce:	31 db                	xor    %ebx,%ebx
        *rp = r->next;
      release(&kmem.lock);
      return p;
    }
  }
  release(&kmem.lock);
  1024d0:	e8 5b 17 00 00       	call   103c30 <release>

  cprintf("kalloc: out of memory\n");
  1024d5:	c7 04 24 c4 5e 10 00 	movl   $0x105ec4,(%esp)
  1024dc:	e8 6f e1 ff ff       	call   100650 <cprintf>
  return 0;
}
  1024e1:	83 c4 18             	add    $0x18,%esp
  1024e4:	89 d8                	mov    %ebx,%eax
  1024e6:	5b                   	pop    %ebx
  1024e7:	c3                   	ret    

  if(n % PAGE || n <= 0)
    panic("kalloc");

  acquire(&kmem.lock);
  for(rp=&kmem.freelist; (r=*rp) != 0; rp=&r->next){
  1024e8:	b9 54 ba 10 00       	mov    $0x10ba54,%ecx
  1024ed:	8d 76 00             	lea    0x0(%esi),%esi
    if(r->len >= n){
      r->len -= n;
  1024f0:	29 d8                	sub    %ebx,%eax
      p = (char*)r + r->len;
      if(r->len == 0)
  1024f2:	85 c0                	test   %eax,%eax
    panic("kalloc");

  acquire(&kmem.lock);
  for(rp=&kmem.freelist; (r=*rp) != 0; rp=&r->next){
    if(r->len >= n){
      r->len -= n;
  1024f4:	89 42 04             	mov    %eax,0x4(%edx)
      p = (char*)r + r->len;
  1024f7:	8d 1c 02             	lea    (%edx,%eax,1),%ebx
      if(r->len == 0)
  1024fa:	75 04                	jne    102500 <kalloc+0x80>
        *rp = r->next;
  1024fc:	8b 02                	mov    (%edx),%eax
  1024fe:	89 01                	mov    %eax,(%ecx)
      release(&kmem.lock);
  102500:	c7 04 24 20 ba 10 00 	movl   $0x10ba20,(%esp)
  102507:	e8 24 17 00 00       	call   103c30 <release>
  }
  release(&kmem.lock);

  cprintf("kalloc: out of memory\n");
  return 0;
}
  10250c:	83 c4 18             	add    $0x18,%esp
  10250f:	89 d8                	mov    %ebx,%eax
  102511:	5b                   	pop    %ebx
  102512:	c3                   	ret    
{
  char *p;
  struct run *r, **rp;

  if(n % PAGE || n <= 0)
    panic("kalloc");
  102513:	c7 04 24 bd 5e 10 00 	movl   $0x105ebd,(%esp)
  10251a:	e8 81 e2 ff ff       	call   1007a0 <panic>
  10251f:	90                   	nop

00102520 <kbdgetc>:
static inline uchar
inb(ushort port)
{
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
  102520:	ba 64 00 00 00       	mov    $0x64,%edx
  102525:	ec                   	in     (%dx),%al
    normalmap, shiftmap, ctlmap, ctlmap
  };
  uint st, data, c;

  st = inb(KBSTATP);
  if((st & KBS_DIB) == 0)
  102526:	a8 01                	test   $0x1,%al
    return -1;
  102528:	b9 ff ff ff ff       	mov    $0xffffffff,%ecx
    normalmap, shiftmap, ctlmap, ctlmap
  };
  uint st, data, c;

  st = inb(KBSTATP);
  if((st & KBS_DIB) == 0)
  10252d:	74 3b                	je     10256a <kbdgetc+0x4a>
  10252f:	b2 60                	mov    $0x60,%dl
  102531:	ec                   	in     (%dx),%al
    return -1;
  data = inb(KBDATAP);
  102532:	0f b6 c0             	movzbl %al,%eax

  if(data == 0xE0){
  102535:	3d e0 00 00 00       	cmp    $0xe0,%eax
  10253a:	0f 84 80 00 00 00    	je     1025c0 <kbdgetc+0xa0>
    shift |= E0ESC;
    return 0;
  } else if(data & 0x80){
  102540:	a8 80                	test   $0x80,%al
  102542:	74 2c                	je     102570 <kbdgetc+0x50>
    // Key released
    data = (shift & E0ESC ? data : data & 0x7F);
  102544:	8b 15 1c 88 10 00    	mov    0x10881c,%edx
  10254a:	f6 c2 40             	test   $0x40,%dl
  10254d:	75 03                	jne    102552 <kbdgetc+0x32>
  10254f:	83 e0 7f             	and    $0x7f,%eax
    shift &= ~(shiftcode[data] | E0ESC);
  102552:	0f b6 80 e0 5e 10 00 	movzbl 0x105ee0(%eax),%eax
    return 0;
  102559:	31 c9                	xor    %ecx,%ecx
    shift |= E0ESC;
    return 0;
  } else if(data & 0x80){
    // Key released
    data = (shift & E0ESC ? data : data & 0x7F);
    shift &= ~(shiftcode[data] | E0ESC);
  10255b:	83 c8 40             	or     $0x40,%eax
  10255e:	0f b6 c0             	movzbl %al,%eax
  102561:	f7 d0                	not    %eax
  102563:	21 d0                	and    %edx,%eax
  102565:	a3 1c 88 10 00       	mov    %eax,0x10881c
      c += 'A' - 'a';
    else if('A' <= c && c <= 'Z')
      c += 'a' - 'A';
  }
  return c;
}
  10256a:	89 c8                	mov    %ecx,%eax
  10256c:	c3                   	ret    
  10256d:	8d 76 00             	lea    0x0(%esi),%esi
  } else if(data & 0x80){
    // Key released
    data = (shift & E0ESC ? data : data & 0x7F);
    shift &= ~(shiftcode[data] | E0ESC);
    return 0;
  } else if(shift & E0ESC){
  102570:	8b 0d 1c 88 10 00    	mov    0x10881c,%ecx
  102576:	f6 c1 40             	test   $0x40,%cl
  102579:	74 05                	je     102580 <kbdgetc+0x60>
    // Last character was an E0 escape; or with 0x80
    data |= 0x80;
  10257b:	0c 80                	or     $0x80,%al
    shift &= ~E0ESC;
  10257d:	83 e1 bf             	and    $0xffffffbf,%ecx
  }

  shift |= shiftcode[data];
  102580:	0f b6 90 e0 5e 10 00 	movzbl 0x105ee0(%eax),%edx
  102587:	09 ca                	or     %ecx,%edx
  shift ^= togglecode[data];
  102589:	0f b6 88 e0 5f 10 00 	movzbl 0x105fe0(%eax),%ecx
  102590:	31 ca                	xor    %ecx,%edx
  c = charcode[shift & (CTL | SHIFT)][data];
  102592:	89 d1                	mov    %edx,%ecx
  102594:	83 e1 03             	and    $0x3,%ecx
  102597:	8b 0c 8d e0 60 10 00 	mov    0x1060e0(,%ecx,4),%ecx
    data |= 0x80;
    shift &= ~E0ESC;
  }

  shift |= shiftcode[data];
  shift ^= togglecode[data];
  10259e:	89 15 1c 88 10 00    	mov    %edx,0x10881c
  c = charcode[shift & (CTL | SHIFT)][data];
  if(shift & CAPSLOCK){
  1025a4:	83 e2 08             	and    $0x8,%edx
    shift &= ~E0ESC;
  }

  shift |= shiftcode[data];
  shift ^= togglecode[data];
  c = charcode[shift & (CTL | SHIFT)][data];
  1025a7:	0f b6 0c 01          	movzbl (%ecx,%eax,1),%ecx
  if(shift & CAPSLOCK){
  1025ab:	74 bd                	je     10256a <kbdgetc+0x4a>
    if('a' <= c && c <= 'z')
  1025ad:	8d 41 9f             	lea    -0x61(%ecx),%eax
  1025b0:	83 f8 19             	cmp    $0x19,%eax
  1025b3:	77 1b                	ja     1025d0 <kbdgetc+0xb0>
      c += 'A' - 'a';
  1025b5:	83 e9 20             	sub    $0x20,%ecx
  1025b8:	eb b0                	jmp    10256a <kbdgetc+0x4a>
  1025ba:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    return -1;
  data = inb(KBDATAP);

  if(data == 0xE0){
    shift |= E0ESC;
    return 0;
  1025c0:	31 c9                	xor    %ecx,%ecx
  if((st & KBS_DIB) == 0)
    return -1;
  data = inb(KBDATAP);

  if(data == 0xE0){
    shift |= E0ESC;
  1025c2:	83 0d 1c 88 10 00 40 	orl    $0x40,0x10881c
      c += 'A' - 'a';
    else if('A' <= c && c <= 'Z')
      c += 'a' - 'A';
  }
  return c;
}
  1025c9:	89 c8                	mov    %ecx,%eax
  1025cb:	c3                   	ret    
  1025cc:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  shift ^= togglecode[data];
  c = charcode[shift & (CTL | SHIFT)][data];
  if(shift & CAPSLOCK){
    if('a' <= c && c <= 'z')
      c += 'A' - 'a';
    else if('A' <= c && c <= 'Z')
  1025d0:	8d 41 bf             	lea    -0x41(%ecx),%eax
  1025d3:	83 f8 19             	cmp    $0x19,%eax
  1025d6:	77 92                	ja     10256a <kbdgetc+0x4a>
      c += 'a' - 'A';
  1025d8:	83 c1 20             	add    $0x20,%ecx
  }
  return c;
  1025db:	eb 8d                	jmp    10256a <kbdgetc+0x4a>
  1025dd:	8d 76 00             	lea    0x0(%esi),%esi

001025e0 <kbdintr>:
}

void
kbdintr(void)
{
  1025e0:	83 ec 1c             	sub    $0x1c,%esp
  consoleintr(kbdgetc);
  1025e3:	c7 04 24 20 25 10 00 	movl   $0x102520,(%esp)
  1025ea:	e8 41 e2 ff ff       	call   100830 <consoleintr>
}
  1025ef:	83 c4 1c             	add    $0x1c,%esp
  1025f2:	c3                   	ret    
  1025f3:	90                   	nop
  1025f4:	90                   	nop
  1025f5:	90                   	nop
  1025f6:	90                   	nop
  1025f7:	90                   	nop
  1025f8:	90                   	nop
  1025f9:	90                   	nop
  1025fa:	90                   	nop
  1025fb:	90                   	nop
  1025fc:	90                   	nop
  1025fd:	90                   	nop
  1025fe:	90                   	nop
  1025ff:	90                   	nop

00102600 <lapicinit>:
}

void
lapicinit(int c)
{
  if(!lapic) 
  102600:	a1 58 ba 10 00       	mov    0x10ba58,%eax
  102605:	85 c0                	test   %eax,%eax
  102607:	0f 84 c3 00 00 00    	je     1026d0 <lapicinit+0xd0>
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  10260d:	c7 80 f0 00 00 00 3f 	movl   $0x13f,0xf0(%eax)
  102614:	01 00 00 
  lapic[ID];  // wait for write to finish, by reading
  102617:	8b 50 20             	mov    0x20(%eax),%edx
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  10261a:	c7 80 e0 03 00 00 0b 	movl   $0xb,0x3e0(%eax)
  102621:	00 00 00 
  lapic[ID];  // wait for write to finish, by reading
  102624:	8b 50 20             	mov    0x20(%eax),%edx
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  102627:	c7 80 20 03 00 00 20 	movl   $0x20020,0x320(%eax)
  10262e:	00 02 00 
  lapic[ID];  // wait for write to finish, by reading
  102631:	8b 50 20             	mov    0x20(%eax),%edx
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  102634:	c7 80 80 03 00 00 80 	movl   $0x989680,0x380(%eax)
  10263b:	96 98 00 
  lapic[ID];  // wait for write to finish, by reading
  10263e:	8b 50 20             	mov    0x20(%eax),%edx
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  102641:	c7 80 50 03 00 00 00 	movl   $0x10000,0x350(%eax)
  102648:	00 01 00 
  lapic[ID];  // wait for write to finish, by reading
  10264b:	8b 50 20             	mov    0x20(%eax),%edx
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  10264e:	c7 80 60 03 00 00 00 	movl   $0x10000,0x360(%eax)
  102655:	00 01 00 
  lapic[ID];  // wait for write to finish, by reading
  102658:	8b 50 20             	mov    0x20(%eax),%edx
  lapicw(LINT0, MASKED);
  lapicw(LINT1, MASKED);

  // Disable performance counter overflow interrupts
  // on machines that provide that interrupt entry.
  if(((lapic[VER]>>16) & 0xFF) >= 4)
  10265b:	8b 50 30             	mov    0x30(%eax),%edx
  10265e:	c1 ea 10             	shr    $0x10,%edx
  102661:	80 fa 03             	cmp    $0x3,%dl
  102664:	77 72                	ja     1026d8 <lapicinit+0xd8>
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  102666:	c7 80 70 03 00 00 33 	movl   $0x33,0x370(%eax)
  10266d:	00 00 00 
  lapic[ID];  // wait for write to finish, by reading
  102670:	8b 50 20             	mov    0x20(%eax),%edx
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  102673:	c7 80 80 02 00 00 00 	movl   $0x0,0x280(%eax)
  10267a:	00 00 00 
  lapic[ID];  // wait for write to finish, by reading
  10267d:	8b 50 20             	mov    0x20(%eax),%edx
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  102680:	c7 80 80 02 00 00 00 	movl   $0x0,0x280(%eax)
  102687:	00 00 00 
  lapic[ID];  // wait for write to finish, by reading
  10268a:	8b 50 20             	mov    0x20(%eax),%edx
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  10268d:	c7 80 b0 00 00 00 00 	movl   $0x0,0xb0(%eax)
  102694:	00 00 00 
  lapic[ID];  // wait for write to finish, by reading
  102697:	8b 50 20             	mov    0x20(%eax),%edx
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  10269a:	c7 80 10 03 00 00 00 	movl   $0x0,0x310(%eax)
  1026a1:	00 00 00 
  lapic[ID];  // wait for write to finish, by reading
  1026a4:	8b 50 20             	mov    0x20(%eax),%edx
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  1026a7:	c7 80 00 03 00 00 00 	movl   $0x88500,0x300(%eax)
  1026ae:	85 08 00 
  lapic[ID];  // wait for write to finish, by reading
  1026b1:	8b 50 20             	mov    0x20(%eax),%edx
  1026b4:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  lapicw(EOI, 0);

  // Send an Init Level De-Assert to synchronise arbitration ID's.
  lapicw(ICRHI, 0);
  lapicw(ICRLO, BCAST | INIT | LEVEL);
  while(lapic[ICRLO] & DELIVS)
  1026b8:	8b 90 00 03 00 00    	mov    0x300(%eax),%edx
  1026be:	80 e6 10             	and    $0x10,%dh
  1026c1:	75 f5                	jne    1026b8 <lapicinit+0xb8>
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  1026c3:	c7 80 80 00 00 00 00 	movl   $0x0,0x80(%eax)
  1026ca:	00 00 00 
  lapic[ID];  // wait for write to finish, by reading
  1026cd:	8b 40 20             	mov    0x20(%eax),%eax
  1026d0:	f3 c3                	repz ret 
  1026d2:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  1026d8:	c7 80 40 03 00 00 00 	movl   $0x10000,0x340(%eax)
  1026df:	00 01 00 
  lapic[ID];  // wait for write to finish, by reading
  1026e2:	8b 50 20             	mov    0x20(%eax),%edx
  1026e5:	e9 7c ff ff ff       	jmp    102666 <lapicinit+0x66>
  1026ea:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi

001026f0 <cpunum>:
  lapicw(TPR, 0);
}

int
cpunum(void)
{
  1026f0:	83 ec 1c             	sub    $0x1c,%esp

static inline uint
readeflags(void)
{
  uint eflags;
  asm volatile("pushfl; popl %0" : "=r" (eflags));
  1026f3:	9c                   	pushf  
  1026f4:	58                   	pop    %eax
  // Cannot call cpu when interrupts are enabled:
  // result not guaranteed to last long enough to be used!
  // Would prefer to panic but even printing is chancy here:
  // almost everything, including cprintf and panic, calls cpu,
  // often indirectly through acquire and release.
  if(readeflags()&FL_IF){
  1026f5:	f6 c4 02             	test   $0x2,%ah
  1026f8:	74 12                	je     10270c <cpunum+0x1c>
    static int n;
    if(n++ == 0)
  1026fa:	a1 20 88 10 00       	mov    0x108820,%eax
  1026ff:	8d 50 01             	lea    0x1(%eax),%edx
  102702:	85 c0                	test   %eax,%eax
  102704:	89 15 20 88 10 00    	mov    %edx,0x108820
  10270a:	74 1c                	je     102728 <cpunum+0x38>
      cprintf("cpu called from %x with interrupts enabled\n",
        __builtin_return_address(0));
  }

  if(lapic)
  10270c:	8b 15 58 ba 10 00    	mov    0x10ba58,%edx
    return lapic[ID]>>24;
  return 0;
  102712:	31 c0                	xor    %eax,%eax
    if(n++ == 0)
      cprintf("cpu called from %x with interrupts enabled\n",
        __builtin_return_address(0));
  }

  if(lapic)
  102714:	85 d2                	test   %edx,%edx
  102716:	74 06                	je     10271e <cpunum+0x2e>
    return lapic[ID]>>24;
  102718:	8b 42 20             	mov    0x20(%edx),%eax
  10271b:	c1 e8 18             	shr    $0x18,%eax
  return 0;
}
  10271e:	83 c4 1c             	add    $0x1c,%esp
  102721:	c3                   	ret    
  102722:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  // almost everything, including cprintf and panic, calls cpu,
  // often indirectly through acquire and release.
  if(readeflags()&FL_IF){
    static int n;
    if(n++ == 0)
      cprintf("cpu called from %x with interrupts enabled\n",
  102728:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  10272c:	c7 04 24 f0 60 10 00 	movl   $0x1060f0,(%esp)
  102733:	89 44 24 04          	mov    %eax,0x4(%esp)
  102737:	e8 14 df ff ff       	call   100650 <cprintf>
  10273c:	eb ce                	jmp    10270c <cpunum+0x1c>
  10273e:	66 90                	xchg   %ax,%ax

00102740 <lapiceoi>:

// Acknowledge interrupt.
void
lapiceoi(void)
{
  if(lapic)
  102740:	a1 58 ba 10 00       	mov    0x10ba58,%eax
  102745:	85 c0                	test   %eax,%eax
  102747:	74 0d                	je     102756 <lapiceoi+0x16>
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  102749:	c7 80 b0 00 00 00 00 	movl   $0x0,0xb0(%eax)
  102750:	00 00 00 
  lapic[ID];  // wait for write to finish, by reading
  102753:	8b 40 20             	mov    0x20(%eax),%eax
  102756:	f3 c3                	repz ret 
  102758:	90                   	nop
  102759:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi

00102760 <microdelay>:
// Spin for a given number of microseconds.
// On real hardware would want to tune this dynamically.
void
microdelay(int us)
{
}
  102760:	f3 c3                	repz ret 
  102762:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  102769:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00102770 <lapicstartap>:

// Start additional processor running bootstrap code at addr.
// See Appendix B of MultiProcessor Specification.
void
lapicstartap(uchar apicid, uint addr)
{
  102770:	53                   	push   %ebx
}

static inline void
outb(ushort port, uchar data)
{
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
  102771:	ba 70 00 00 00       	mov    $0x70,%edx
  102776:	8b 4c 24 0c          	mov    0xc(%esp),%ecx
  10277a:	0f b6 5c 24 08       	movzbl 0x8(%esp),%ebx
  10277f:	b8 0f 00 00 00       	mov    $0xf,%eax
  102784:	ee                   	out    %al,(%dx)
  102785:	b8 0a 00 00 00       	mov    $0xa,%eax
  10278a:	b2 71                	mov    $0x71,%dl
  10278c:	ee                   	out    %al,(%dx)
  // the AP startup code prior to the [universal startup algorithm]."
  outb(IO_RTC, 0xF);  // offset 0xF is shutdown code
  outb(IO_RTC+1, 0x0A);
  wrv = (ushort*)(0x40<<4 | 0x67);  // Warm reset vector
  wrv[0] = 0;
  wrv[1] = addr >> 4;
  10278d:	89 c8                	mov    %ecx,%eax
  10278f:	c1 e8 04             	shr    $0x4,%eax
  102792:	66 a3 69 04 00 00    	mov    %ax,0x469
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  102798:	a1 58 ba 10 00       	mov    0x10ba58,%eax
  // when it is in the halted state due to an INIT.  So the second
  // should be ignored, but it is part of the official Intel algorithm.
  // Bochs complains about the second one.  Too bad for Bochs.
  for(i = 0; i < 2; i++){
    lapicw(ICRHI, apicid<<24);
    lapicw(ICRLO, STARTUP | (addr>>12));
  10279d:	c1 e9 0c             	shr    $0xc,%ecx
  wrv[0] = 0;
  wrv[1] = addr >> 4;

  // "Universal startup algorithm."
  // Send INIT (level-triggered) interrupt to reset other CPU.
  lapicw(ICRHI, apicid<<24);
  1027a0:	c1 e3 18             	shl    $0x18,%ebx
  // when it is in the halted state due to an INIT.  So the second
  // should be ignored, but it is part of the official Intel algorithm.
  // Bochs complains about the second one.  Too bad for Bochs.
  for(i = 0; i < 2; i++){
    lapicw(ICRHI, apicid<<24);
    lapicw(ICRLO, STARTUP | (addr>>12));
  1027a3:	80 cd 06             	or     $0x6,%ch
  // and the warm reset vector (DWORD based at 40:67) to point at
  // the AP startup code prior to the [universal startup algorithm]."
  outb(IO_RTC, 0xF);  // offset 0xF is shutdown code
  outb(IO_RTC+1, 0x0A);
  wrv = (ushort*)(0x40<<4 | 0x67);  // Warm reset vector
  wrv[0] = 0;
  1027a6:	66 c7 05 67 04 00 00 	movw   $0x0,0x467
  1027ad:	00 00 
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  1027af:	89 98 10 03 00 00    	mov    %ebx,0x310(%eax)
  lapic[ID];  // wait for write to finish, by reading
  1027b5:	8b 50 20             	mov    0x20(%eax),%edx
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  1027b8:	c7 80 00 03 00 00 00 	movl   $0xc500,0x300(%eax)
  1027bf:	c5 00 00 
  lapic[ID];  // wait for write to finish, by reading
  1027c2:	8b 50 20             	mov    0x20(%eax),%edx
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  1027c5:	c7 80 00 03 00 00 00 	movl   $0x8500,0x300(%eax)
  1027cc:	85 00 00 
  lapic[ID];  // wait for write to finish, by reading
  1027cf:	8b 50 20             	mov    0x20(%eax),%edx
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  1027d2:	89 98 10 03 00 00    	mov    %ebx,0x310(%eax)
  lapic[ID];  // wait for write to finish, by reading
  1027d8:	8b 50 20             	mov    0x20(%eax),%edx
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  1027db:	89 88 00 03 00 00    	mov    %ecx,0x300(%eax)
  lapic[ID];  // wait for write to finish, by reading
  1027e1:	8b 50 20             	mov    0x20(%eax),%edx
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  1027e4:	89 98 10 03 00 00    	mov    %ebx,0x310(%eax)
  lapic[ID];  // wait for write to finish, by reading
  1027ea:	8b 50 20             	mov    0x20(%eax),%edx
volatile uint *lapic;  // Initialized in mp.c

static void
lapicw(int index, int value)
{
  lapic[index] = value;
  1027ed:	89 88 00 03 00 00    	mov    %ecx,0x300(%eax)
  lapic[ID];  // wait for write to finish, by reading
  1027f3:	8b 40 20             	mov    0x20(%eax),%eax
  for(i = 0; i < 2; i++){
    lapicw(ICRHI, apicid<<24);
    lapicw(ICRLO, STARTUP | (addr>>12));
    microdelay(200);
  }
}
  1027f6:	5b                   	pop    %ebx
  1027f7:	c3                   	ret    
  1027f8:	90                   	nop
  1027f9:	90                   	nop
  1027fa:	90                   	nop
  1027fb:	90                   	nop
  1027fc:	90                   	nop
  1027fd:	90                   	nop
  1027fe:	90                   	nop
  1027ff:	90                   	nop

00102800 <mpmain>:

// Bootstrap processor gets here after setting up the hardware.
// Additional processors start here.
static void
mpmain(void)
{
  102800:	53                   	push   %ebx
  102801:	83 ec 18             	sub    $0x18,%esp
  if(cpunum() != mpbcpu())
  102804:	e8 e7 fe ff ff       	call   1026f0 <cpunum>
  102809:	89 c3                	mov    %eax,%ebx
  10280b:	e8 d0 00 00 00       	call   1028e0 <mpbcpu>
  102810:	39 c3                	cmp    %eax,%ebx
  102812:	74 0d                	je     102821 <mpmain+0x21>
    lapicinit(cpunum());
  102814:	e8 d7 fe ff ff       	call   1026f0 <cpunum>
  102819:	89 04 24             	mov    %eax,(%esp)
  10281c:	e8 df fd ff ff       	call   102600 <lapicinit>
  ksegment();
  102821:	e8 1a 09 00 00       	call   103140 <ksegment>
  cprintf("cpu%d: mpmain\n", cpu->id);
  102826:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
  10282c:	0f b6 00             	movzbl (%eax),%eax
  10282f:	c7 04 24 1c 61 10 00 	movl   $0x10611c,(%esp)
  102836:	89 44 24 04          	mov    %eax,0x4(%esp)
  10283a:	e8 11 de ff ff       	call   100650 <cprintf>
  idtinit();
  10283f:	e8 4c 26 00 00       	call   104e90 <idtinit>
  xchg(&cpu->booted, 1);
  102844:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
xchg(volatile uint *addr, uint newval)
{
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
  10284b:	b8 01 00 00 00       	mov    $0x1,%eax
  102850:	f0 87 82 a8 00 00 00 	lock xchg %eax,0xa8(%edx)

  cprintf("cpu%d: scheduling\n", cpu->id);
  102857:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
  10285d:	0f b6 00             	movzbl (%eax),%eax
  102860:	c7 04 24 2b 61 10 00 	movl   $0x10612b,(%esp)
  102867:	89 44 24 04          	mov    %eax,0x4(%esp)
  10286b:	e8 e0 dd ff ff       	call   100650 <cprintf>
  scheduler();
  102870:	e8 2b 0d 00 00       	call   1035a0 <scheduler>
  102875:	90                   	nop
  102876:	90                   	nop
  102877:	90                   	nop
  102878:	90                   	nop
  102879:	90                   	nop
  10287a:	90                   	nop
  10287b:	90                   	nop
  10287c:	90                   	nop
  10287d:	90                   	nop
  10287e:	90                   	nop
  10287f:	90                   	nop

00102880 <mpsearch1>:
}

// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uchar *addr, int len)
{
  102880:	56                   	push   %esi
  102881:	53                   	push   %ebx

  e = addr+len;
  for(p = addr; p < e; p += sizeof(struct mp))
    if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
      return (struct mp*)p;
  return 0;
  102882:	31 db                	xor    %ebx,%ebx
static struct mp*
mpsearch1(uchar *addr, int len)
{
  uchar *e, *p;

  e = addr+len;
  102884:	8d 34 10             	lea    (%eax,%edx,1),%esi
}

// Look for an MP structure in the len bytes at addr.
static struct mp*
mpsearch1(uchar *addr, int len)
{
  102887:	83 ec 14             	sub    $0x14,%esp
  uchar *e, *p;

  e = addr+len;
  for(p = addr; p < e; p += sizeof(struct mp))
  10288a:	39 f0                	cmp    %esi,%eax
  10288c:	73 3d                	jae    1028cb <mpsearch1+0x4b>
  10288e:	89 c3                	mov    %eax,%ebx
    if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
  102890:	c7 44 24 08 04 00 00 	movl   $0x4,0x8(%esp)
  102897:	00 
  102898:	c7 44 24 04 65 61 10 	movl   $0x106165,0x4(%esp)
  10289f:	00 
  1028a0:	89 1c 24             	mov    %ebx,(%esp)
  1028a3:	e8 f8 13 00 00       	call   103ca0 <memcmp>
  1028a8:	85 c0                	test   %eax,%eax
  1028aa:	75 16                	jne    1028c2 <mpsearch1+0x42>
  1028ac:	31 d2                	xor    %edx,%edx
  1028ae:	66 90                	xchg   %ax,%ax
{
  int i, sum;
  
  sum = 0;
  for(i=0; i<len; i++)
    sum += addr[i];
  1028b0:	0f b6 0c 03          	movzbl (%ebx,%eax,1),%ecx
sum(uchar *addr, int len)
{
  int i, sum;
  
  sum = 0;
  for(i=0; i<len; i++)
  1028b4:	83 c0 01             	add    $0x1,%eax
    sum += addr[i];
  1028b7:	01 ca                	add    %ecx,%edx
sum(uchar *addr, int len)
{
  int i, sum;
  
  sum = 0;
  for(i=0; i<len; i++)
  1028b9:	83 f8 10             	cmp    $0x10,%eax
  1028bc:	75 f2                	jne    1028b0 <mpsearch1+0x30>
{
  uchar *e, *p;

  e = addr+len;
  for(p = addr; p < e; p += sizeof(struct mp))
    if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
  1028be:	84 d2                	test   %dl,%dl
  1028c0:	74 09                	je     1028cb <mpsearch1+0x4b>
mpsearch1(uchar *addr, int len)
{
  uchar *e, *p;

  e = addr+len;
  for(p = addr; p < e; p += sizeof(struct mp))
  1028c2:	83 c3 10             	add    $0x10,%ebx
  1028c5:	39 de                	cmp    %ebx,%esi
  1028c7:	77 c7                	ja     102890 <mpsearch1+0x10>
    if(memcmp(p, "_MP_", 4) == 0 && sum(p, sizeof(struct mp)) == 0)
      return (struct mp*)p;
  return 0;
  1028c9:	31 db                	xor    %ebx,%ebx
}
  1028cb:	83 c4 14             	add    $0x14,%esp
  1028ce:	89 d8                	mov    %ebx,%eax
  1028d0:	5b                   	pop    %ebx
  1028d1:	5e                   	pop    %esi
  1028d2:	c3                   	ret    
  1028d3:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  1028d9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

001028e0 <mpbcpu>:
uchar ioapicid;

int
mpbcpu(void)
{
  return bcpu-cpus;
  1028e0:	a1 24 88 10 00       	mov    0x108824,%eax
  1028e5:	2d 80 ba 10 00       	sub    $0x10ba80,%eax
  1028ea:	c1 f8 02             	sar    $0x2,%eax
  1028ed:	69 c0 cf 46 7d 67    	imul   $0x677d46cf,%eax,%eax
}
  1028f3:	c3                   	ret    
  1028f4:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  1028fa:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00102900 <mpinit>:
  return conf;
}

void
mpinit(void)
{
  102900:	57                   	push   %edi
  102901:	56                   	push   %esi
  102902:	53                   	push   %ebx
  102903:	83 ec 10             	sub    $0x10,%esp
  uchar *bda;
  uint p;
  struct mp *mp;

  bda = (uchar*)0x400;
  if((p = ((bda[0x0F]<<8)|bda[0x0E]) << 4)){
  102906:	0f b6 05 0f 04 00 00 	movzbl 0x40f,%eax
  10290d:	0f b6 15 0e 04 00 00 	movzbl 0x40e,%edx
  struct mp *mp;
  struct mpconf *conf;
  struct mpproc *proc;
  struct mpioapic *ioapic;

  bcpu = &cpus[0];
  102914:	c7 05 24 88 10 00 80 	movl   $0x10ba80,0x108824
  10291b:	ba 10 00 
  uchar *bda;
  uint p;
  struct mp *mp;

  bda = (uchar*)0x400;
  if((p = ((bda[0x0F]<<8)|bda[0x0E]) << 4)){
  10291e:	c1 e0 08             	shl    $0x8,%eax
  102921:	09 d0                	or     %edx,%eax
  102923:	c1 e0 04             	shl    $0x4,%eax
  102926:	85 c0                	test   %eax,%eax
  102928:	75 1b                	jne    102945 <mpinit+0x45>
    if((mp = mpsearch1((uchar*)p, 1024)))
      return mp;
  } else {
    p = ((bda[0x14]<<8)|bda[0x13])*1024;
  10292a:	0f b6 05 14 04 00 00 	movzbl 0x414,%eax
  102931:	0f b6 15 13 04 00 00 	movzbl 0x413,%edx
  102938:	c1 e0 08             	shl    $0x8,%eax
  10293b:	09 d0                	or     %edx,%eax
  10293d:	c1 e0 0a             	shl    $0xa,%eax
    if((mp = mpsearch1((uchar*)p-1024, 1024)))
  102940:	2d 00 04 00 00       	sub    $0x400,%eax
  102945:	ba 00 04 00 00       	mov    $0x400,%edx
  10294a:	e8 31 ff ff ff       	call   102880 <mpsearch1>
  10294f:	85 c0                	test   %eax,%eax
  102951:	89 c6                	mov    %eax,%esi
  102953:	0f 84 3f 01 00 00    	je     102a98 <mpinit+0x198>
mpconfig(struct mp **pmp)
{
  struct mpconf *conf;
  struct mp *mp;

  if((mp = mpsearch()) == 0 || mp->physaddr == 0)
  102959:	8b 5e 04             	mov    0x4(%esi),%ebx
  10295c:	85 db                	test   %ebx,%ebx
  10295e:	0f 84 dc 00 00 00    	je     102a40 <mpinit+0x140>
    return 0;
  conf = (struct mpconf*)mp->physaddr;
  if(memcmp(conf, "PCMP", 4) != 0)
  102964:	c7 44 24 08 04 00 00 	movl   $0x4,0x8(%esp)
  10296b:	00 
  10296c:	c7 44 24 04 6a 61 10 	movl   $0x10616a,0x4(%esp)
  102973:	00 
  102974:	89 1c 24             	mov    %ebx,(%esp)
  102977:	e8 24 13 00 00       	call   103ca0 <memcmp>
  10297c:	85 c0                	test   %eax,%eax
  10297e:	0f 85 bc 00 00 00    	jne    102a40 <mpinit+0x140>
    return 0;
  if(conf->version != 1 && conf->version != 4)
  102984:	0f b6 43 06          	movzbl 0x6(%ebx),%eax
  102988:	3c 04                	cmp    $0x4,%al
  10298a:	0f 85 28 01 00 00    	jne    102ab8 <mpinit+0x1b8>
    return 0;
  if(sum((uchar*)conf, conf->length) != 0)
  102990:	0f b7 7b 04          	movzwl 0x4(%ebx),%edi
sum(uchar *addr, int len)
{
  int i, sum;
  
  sum = 0;
  for(i=0; i<len; i++)
  102994:	85 ff                	test   %edi,%edi
  102996:	74 1d                	je     1029b5 <mpinit+0xb5>
  102998:	31 d2                	xor    %edx,%edx
  10299a:	31 c0                	xor    %eax,%eax
  10299c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    sum += addr[i];
  1029a0:	0f b6 0c 03          	movzbl (%ebx,%eax,1),%ecx
sum(uchar *addr, int len)
{
  int i, sum;
  
  sum = 0;
  for(i=0; i<len; i++)
  1029a4:	83 c0 01             	add    $0x1,%eax
    sum += addr[i];
  1029a7:	01 ca                	add    %ecx,%edx
sum(uchar *addr, int len)
{
  int i, sum;
  
  sum = 0;
  for(i=0; i<len; i++)
  1029a9:	39 c7                	cmp    %eax,%edi
  1029ab:	7f f3                	jg     1029a0 <mpinit+0xa0>
  conf = (struct mpconf*)mp->physaddr;
  if(memcmp(conf, "PCMP", 4) != 0)
    return 0;
  if(conf->version != 1 && conf->version != 4)
    return 0;
  if(sum((uchar*)conf, conf->length) != 0)
  1029ad:	84 d2                	test   %dl,%dl
  1029af:	0f 85 8b 00 00 00    	jne    102a40 <mpinit+0x140>

  bcpu = &cpus[0];
  if((conf = mpconfig(&mp)) == 0)
    return;
  ismp = 1;
  lapic = (uint*)conf->lapicaddr;
  1029b5:	8b 43 24             	mov    0x24(%ebx),%eax
  struct mpioapic *ioapic;

  bcpu = &cpus[0];
  if((conf = mpconfig(&mp)) == 0)
    return;
  ismp = 1;
  1029b8:	c7 05 64 ba 10 00 01 	movl   $0x1,0x10ba64
  1029bf:	00 00 00 
  lapic = (uint*)conf->lapicaddr;
  for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
  1029c2:	8b 0d 24 88 10 00    	mov    0x108824,%ecx

  bcpu = &cpus[0];
  if((conf = mpconfig(&mp)) == 0)
    return;
  ismp = 1;
  lapic = (uint*)conf->lapicaddr;
  1029c8:	a3 58 ba 10 00       	mov    %eax,0x10ba58
  for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
  1029cd:	8d 43 2c             	lea    0x2c(%ebx),%eax
  1029d0:	01 fb                	add    %edi,%ebx
  1029d2:	39 d8                	cmp    %ebx,%eax
  1029d4:	73 4f                	jae    102a25 <mpinit+0x125>
    switch(*p){
  1029d6:	0f b6 10             	movzbl (%eax),%edx
  1029d9:	80 fa 04             	cmp    $0x4,%dl
  1029dc:	76 2a                	jbe    102a08 <mpinit+0x108>
    case MPIOINTR:
    case MPLINTR:
      p += 8;
      continue;
    default:
      cprintf("mpinit: unknown config type %x\n", *p);
  1029de:	0f b6 d2             	movzbl %dl,%edx
      continue;
    case MPBUS:
    case MPIOINTR:
    case MPLINTR:
      p += 8;
      continue;
  1029e1:	89 0d 24 88 10 00    	mov    %ecx,0x108824
    default:
      cprintf("mpinit: unknown config type %x\n", *p);
  1029e7:	89 54 24 04          	mov    %edx,0x4(%esp)
  1029eb:	c7 04 24 94 61 10 00 	movl   $0x106194,(%esp)
  1029f2:	e8 59 dc ff ff       	call   100650 <cprintf>
      panic("mpinit");
  1029f7:	c7 04 24 8a 61 10 00 	movl   $0x10618a,(%esp)
  1029fe:	e8 9d dd ff ff       	call   1007a0 <panic>
  102a03:	90                   	nop
  102a04:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  if((conf = mpconfig(&mp)) == 0)
    return;
  ismp = 1;
  lapic = (uint*)conf->lapicaddr;
  for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
    switch(*p){
  102a08:	0f b6 d2             	movzbl %dl,%edx
  102a0b:	ff 24 95 b4 61 10 00 	jmp    *0x1061b4(,%edx,4)
  102a12:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
      p += sizeof(struct mpioapic);
      continue;
    case MPBUS:
    case MPIOINTR:
    case MPLINTR:
      p += 8;
  102a18:	83 c0 08             	add    $0x8,%eax
  bcpu = &cpus[0];
  if((conf = mpconfig(&mp)) == 0)
    return;
  ismp = 1;
  lapic = (uint*)conf->lapicaddr;
  for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
  102a1b:	39 c3                	cmp    %eax,%ebx
  102a1d:	77 b7                	ja     1029d6 <mpinit+0xd6>
  102a1f:	89 0d 24 88 10 00    	mov    %ecx,0x108824
    default:
      cprintf("mpinit: unknown config type %x\n", *p);
      panic("mpinit");
    }
  }
  if(mp->imcrp){
  102a25:	80 7e 0c 00          	cmpb   $0x0,0xc(%esi)
  102a29:	74 15                	je     102a40 <mpinit+0x140>
}

static inline void
outb(ushort port, uchar data)
{
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
  102a2b:	ba 22 00 00 00       	mov    $0x22,%edx
  102a30:	b8 70 00 00 00       	mov    $0x70,%eax
  102a35:	ee                   	out    %al,(%dx)
static inline uchar
inb(ushort port)
{
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
  102a36:	b2 23                	mov    $0x23,%dl
  102a38:	ec                   	in     (%dx),%al
    // Bochs doesn't support IMCR, so this doesn't run on Bochs.
    // But it would on real hardware.
    outb(0x22, 0x70);   // Select IMCR
    outb(0x23, inb(0x23) | 1);  // Mask external interrupts.
  102a39:	83 c8 01             	or     $0x1,%eax
}

static inline void
outb(ushort port, uchar data)
{
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
  102a3c:	ee                   	out    %al,(%dx)
  102a3d:	8d 76 00             	lea    0x0(%esi),%esi
  }
}
  102a40:	83 c4 10             	add    $0x10,%esp
  102a43:	5b                   	pop    %ebx
  102a44:	5e                   	pop    %esi
  102a45:	5f                   	pop    %edi
  102a46:	c3                   	ret    
  102a47:	90                   	nop
  lapic = (uint*)conf->lapicaddr;
  for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
    switch(*p){
    case MPPROC:
      proc = (struct mpproc*)p;
      if(ncpu != proc->apicid) {
  102a48:	0f b6 50 01          	movzbl 0x1(%eax),%edx
  102a4c:	8b 3d 60 c0 10 00    	mov    0x10c060,%edi
  102a52:	39 fa                	cmp    %edi,%edx
  102a54:	75 6f                	jne    102ac5 <mpinit+0x1c5>
        cprintf("mpinit: ncpu=%d apicpid=%d", ncpu, proc->apicid);
        panic("mpinit");
      }
      if(proc->flags & MPBOOT)
  102a56:	f6 40 03 02          	testb  $0x2,0x3(%eax)
  102a5a:	74 0c                	je     102a68 <mpinit+0x168>
        bcpu = &cpus[ncpu];
  102a5c:	69 ca bc 00 00 00    	imul   $0xbc,%edx,%ecx
  102a62:	81 c1 80 ba 10 00    	add    $0x10ba80,%ecx
      cpus[ncpu].id = ncpu;
  102a68:	69 fa bc 00 00 00    	imul   $0xbc,%edx,%edi
      ncpu++;
      p += sizeof(struct mpproc);
  102a6e:	83 c0 14             	add    $0x14,%eax
        cprintf("mpinit: ncpu=%d apicpid=%d", ncpu, proc->apicid);
        panic("mpinit");
      }
      if(proc->flags & MPBOOT)
        bcpu = &cpus[ncpu];
      cpus[ncpu].id = ncpu;
  102a71:	88 97 80 ba 10 00    	mov    %dl,0x10ba80(%edi)
      ncpu++;
  102a77:	83 c2 01             	add    $0x1,%edx
  102a7a:	89 15 60 c0 10 00    	mov    %edx,0x10c060
      p += sizeof(struct mpproc);
      continue;
  102a80:	eb 99                	jmp    102a1b <mpinit+0x11b>
  102a82:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    case MPIOAPIC:
      ioapic = (struct mpioapic*)p;
      ioapicid = ioapic->apicno;
  102a88:	0f b6 50 01          	movzbl 0x1(%eax),%edx
      p += sizeof(struct mpioapic);
  102a8c:	83 c0 08             	add    $0x8,%eax
      ncpu++;
      p += sizeof(struct mpproc);
      continue;
    case MPIOAPIC:
      ioapic = (struct mpioapic*)p;
      ioapicid = ioapic->apicno;
  102a8f:	88 15 60 ba 10 00    	mov    %dl,0x10ba60
      p += sizeof(struct mpioapic);
      continue;
  102a95:	eb 84                	jmp    102a1b <mpinit+0x11b>
  102a97:	90                   	nop
  } else {
    p = ((bda[0x14]<<8)|bda[0x13])*1024;
    if((mp = mpsearch1((uchar*)p-1024, 1024)))
      return mp;
  }
  return mpsearch1((uchar*)0xF0000, 0x10000);
  102a98:	ba 00 00 01 00       	mov    $0x10000,%edx
  102a9d:	b8 00 00 0f 00       	mov    $0xf0000,%eax
  102aa2:	e8 d9 fd ff ff       	call   102880 <mpsearch1>
mpconfig(struct mp **pmp)
{
  struct mpconf *conf;
  struct mp *mp;

  if((mp = mpsearch()) == 0 || mp->physaddr == 0)
  102aa7:	85 c0                	test   %eax,%eax
  } else {
    p = ((bda[0x14]<<8)|bda[0x13])*1024;
    if((mp = mpsearch1((uchar*)p-1024, 1024)))
      return mp;
  }
  return mpsearch1((uchar*)0xF0000, 0x10000);
  102aa9:	89 c6                	mov    %eax,%esi
mpconfig(struct mp **pmp)
{
  struct mpconf *conf;
  struct mp *mp;

  if((mp = mpsearch()) == 0 || mp->physaddr == 0)
  102aab:	0f 85 a8 fe ff ff    	jne    102959 <mpinit+0x59>
  102ab1:	eb 8d                	jmp    102a40 <mpinit+0x140>
  102ab3:	90                   	nop
  102ab4:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    return 0;
  conf = (struct mpconf*)mp->physaddr;
  if(memcmp(conf, "PCMP", 4) != 0)
    return 0;
  if(conf->version != 1 && conf->version != 4)
  102ab8:	3c 01                	cmp    $0x1,%al
  102aba:	0f 84 d0 fe ff ff    	je     102990 <mpinit+0x90>
  102ac0:	e9 7b ff ff ff       	jmp    102a40 <mpinit+0x140>
  lapic = (uint*)conf->lapicaddr;
  for(p=(uchar*)(conf+1), e=(uchar*)conf+conf->length; p<e; ){
    switch(*p){
    case MPPROC:
      proc = (struct mpproc*)p;
      if(ncpu != proc->apicid) {
  102ac5:	89 0d 24 88 10 00    	mov    %ecx,0x108824
        cprintf("mpinit: ncpu=%d apicpid=%d", ncpu, proc->apicid);
  102acb:	89 54 24 08          	mov    %edx,0x8(%esp)
  102acf:	89 7c 24 04          	mov    %edi,0x4(%esp)
  102ad3:	c7 04 24 6f 61 10 00 	movl   $0x10616f,(%esp)
  102ada:	e8 71 db ff ff       	call   100650 <cprintf>
        panic("mpinit");
  102adf:	c7 04 24 8a 61 10 00 	movl   $0x10618a,(%esp)
  102ae6:	e8 b5 dc ff ff       	call   1007a0 <panic>
  102aeb:	90                   	nop
  102aec:	90                   	nop
  102aed:	90                   	nop
  102aee:	90                   	nop
  102aef:	90                   	nop

00102af0 <picenable>:
}

void
picenable(int irq)
{
  picsetmask(irqmask & ~(1<<irq));
  102af0:	8b 4c 24 04          	mov    0x4(%esp),%ecx
  102af4:	b8 fe ff ff ff       	mov    $0xfffffffe,%eax
  102af9:	ba 21 00 00 00       	mov    $0x21,%edx
  102afe:	d3 c0                	rol    %cl,%eax
  102b00:	66 23 05 00 83 10 00 	and    0x108300,%ax
static ushort irqmask = 0xFFFF & ~(1<<IRQ_SLAVE);

static void
picsetmask(ushort mask)
{
  irqmask = mask;
  102b07:	66 a3 00 83 10 00    	mov    %ax,0x108300
  102b0d:	ee                   	out    %al,(%dx)
  outb(IO_PIC1+1, mask);
  outb(IO_PIC2+1, mask >> 8);
  102b0e:	66 c1 e8 08          	shr    $0x8,%ax
  102b12:	b2 a1                	mov    $0xa1,%dl
  102b14:	ee                   	out    %al,(%dx)

void
picenable(int irq)
{
  picsetmask(irqmask & ~(1<<irq));
}
  102b15:	c3                   	ret    
  102b16:	8d 76 00             	lea    0x0(%esi),%esi
  102b19:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00102b20 <picinit>:

// Initialize the 8259A interrupt controllers.
void
picinit(void)
{
  102b20:	83 ec 10             	sub    $0x10,%esp
  102b23:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
  102b28:	89 74 24 04          	mov    %esi,0x4(%esp)
  102b2c:	be 21 00 00 00       	mov    $0x21,%esi
  102b31:	89 1c 24             	mov    %ebx,(%esp)
  102b34:	89 f2                	mov    %esi,%edx
  102b36:	89 7c 24 08          	mov    %edi,0x8(%esp)
  102b3a:	89 6c 24 0c          	mov    %ebp,0xc(%esp)
  102b3e:	ee                   	out    %al,(%dx)
  102b3f:	bb a1 00 00 00       	mov    $0xa1,%ebx
  102b44:	89 da                	mov    %ebx,%edx
  102b46:	ee                   	out    %al,(%dx)
  102b47:	bd 11 00 00 00       	mov    $0x11,%ebp
  102b4c:	b9 20 00 00 00       	mov    $0x20,%ecx
  102b51:	89 e8                	mov    %ebp,%eax
  102b53:	89 ca                	mov    %ecx,%edx
  102b55:	ee                   	out    %al,(%dx)
  102b56:	b8 20 00 00 00       	mov    $0x20,%eax
  102b5b:	89 f2                	mov    %esi,%edx
  102b5d:	ee                   	out    %al,(%dx)
  102b5e:	b8 04 00 00 00       	mov    $0x4,%eax
  102b63:	ee                   	out    %al,(%dx)
  102b64:	b8 03 00 00 00       	mov    $0x3,%eax
  102b69:	ee                   	out    %al,(%dx)
  102b6a:	bf a0 00 00 00       	mov    $0xa0,%edi
  102b6f:	89 e8                	mov    %ebp,%eax
  102b71:	89 fa                	mov    %edi,%edx
  102b73:	ee                   	out    %al,(%dx)
  102b74:	b8 28 00 00 00       	mov    $0x28,%eax
  102b79:	89 da                	mov    %ebx,%edx
  102b7b:	ee                   	out    %al,(%dx)
  102b7c:	b8 02 00 00 00       	mov    $0x2,%eax
  102b81:	ee                   	out    %al,(%dx)
  102b82:	b8 03 00 00 00       	mov    $0x3,%eax
  102b87:	ee                   	out    %al,(%dx)
  102b88:	be 68 00 00 00       	mov    $0x68,%esi
  102b8d:	89 ca                	mov    %ecx,%edx
  102b8f:	89 f0                	mov    %esi,%eax
  102b91:	ee                   	out    %al,(%dx)
  102b92:	bb 0a 00 00 00       	mov    $0xa,%ebx
  102b97:	89 d8                	mov    %ebx,%eax
  102b99:	ee                   	out    %al,(%dx)
  102b9a:	89 f0                	mov    %esi,%eax
  102b9c:	89 fa                	mov    %edi,%edx
  102b9e:	ee                   	out    %al,(%dx)
  102b9f:	89 d8                	mov    %ebx,%eax
  102ba1:	ee                   	out    %al,(%dx)
  outb(IO_PIC1, 0x0a);             // read IRR by default

  outb(IO_PIC2, 0x68);             // OCW3
  outb(IO_PIC2, 0x0a);             // OCW3

  if(irqmask != 0xFFFF)
  102ba2:	0f b7 05 00 83 10 00 	movzwl 0x108300,%eax
  102ba9:	66 83 f8 ff          	cmp    $0xffff,%ax
  102bad:	74 0a                	je     102bb9 <picinit+0x99>
  102baf:	b2 21                	mov    $0x21,%dl
  102bb1:	ee                   	out    %al,(%dx)
static void
picsetmask(ushort mask)
{
  irqmask = mask;
  outb(IO_PIC1+1, mask);
  outb(IO_PIC2+1, mask >> 8);
  102bb2:	66 c1 e8 08          	shr    $0x8,%ax
  102bb6:	b2 a1                	mov    $0xa1,%dl
  102bb8:	ee                   	out    %al,(%dx)
  outb(IO_PIC2, 0x68);             // OCW3
  outb(IO_PIC2, 0x0a);             // OCW3

  if(irqmask != 0xFFFF)
    picsetmask(irqmask);
}
  102bb9:	8b 1c 24             	mov    (%esp),%ebx
  102bbc:	8b 74 24 04          	mov    0x4(%esp),%esi
  102bc0:	8b 7c 24 08          	mov    0x8(%esp),%edi
  102bc4:	8b 6c 24 0c          	mov    0xc(%esp),%ebp
  102bc8:	83 c4 10             	add    $0x10,%esp
  102bcb:	c3                   	ret    
  102bcc:	90                   	nop
  102bcd:	90                   	nop
  102bce:	90                   	nop
  102bcf:	90                   	nop

00102bd0 <pipealloc>:
  int writeopen;  // write fd is still open
};

int
pipealloc(struct file **f0, struct file **f1)
{
  102bd0:	83 ec 1c             	sub    $0x1c,%esp
  102bd3:	89 5c 24 10          	mov    %ebx,0x10(%esp)
  102bd7:	8b 5c 24 24          	mov    0x24(%esp),%ebx
  102bdb:	89 74 24 14          	mov    %esi,0x14(%esp)
  102bdf:	8b 74 24 20          	mov    0x20(%esp),%esi
  102be3:	89 7c 24 18          	mov    %edi,0x18(%esp)
  struct pipe *p;

  p = 0;
  *f0 = *f1 = 0;
  102be7:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  102bed:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
  if((*f0 = filealloc()) == 0 || (*f1 = filealloc()) == 0)
  102bf3:	e8 18 e2 ff ff       	call   100e10 <filealloc>
  102bf8:	85 c0                	test   %eax,%eax
  102bfa:	89 06                	mov    %eax,(%esi)
  102bfc:	0f 84 b4 00 00 00    	je     102cb6 <pipealloc+0xe6>
  102c02:	e8 09 e2 ff ff       	call   100e10 <filealloc>
  102c07:	85 c0                	test   %eax,%eax
  102c09:	89 03                	mov    %eax,(%ebx)
  102c0b:	0f 84 97 00 00 00    	je     102ca8 <pipealloc+0xd8>
    goto bad;
  if((p = (struct pipe*)kalloc(PAGE)) == 0)
  102c11:	c7 04 24 00 10 00 00 	movl   $0x1000,(%esp)
  102c18:	e8 63 f8 ff ff       	call   102480 <kalloc>
  102c1d:	85 c0                	test   %eax,%eax
  102c1f:	89 c7                	mov    %eax,%edi
  102c21:	0f 84 81 00 00 00    	je     102ca8 <pipealloc+0xd8>
    goto bad;
  p->readopen = 1;
  102c27:	c7 80 3c 02 00 00 01 	movl   $0x1,0x23c(%eax)
  102c2e:	00 00 00 
  p->writeopen = 1;
  102c31:	c7 80 40 02 00 00 01 	movl   $0x1,0x240(%eax)
  102c38:	00 00 00 
  p->nwrite = 0;
  102c3b:	c7 80 38 02 00 00 00 	movl   $0x0,0x238(%eax)
  102c42:	00 00 00 
  p->nread = 0;
  102c45:	c7 80 34 02 00 00 00 	movl   $0x0,0x234(%eax)
  102c4c:	00 00 00 
  initlock(&p->lock, "pipe");
  102c4f:	89 04 24             	mov    %eax,(%esp)
  102c52:	c7 44 24 04 c8 61 10 	movl   $0x1061c8,0x4(%esp)
  102c59:	00 
  102c5a:	e8 51 0e 00 00       	call   103ab0 <initlock>
  (*f0)->type = FD_PIPE;
  102c5f:	8b 06                	mov    (%esi),%eax
  102c61:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
  (*f0)->readable = 1;
  102c67:	8b 06                	mov    (%esi),%eax
  102c69:	c6 40 08 01          	movb   $0x1,0x8(%eax)
  (*f0)->writable = 0;
  102c6d:	8b 06                	mov    (%esi),%eax
  102c6f:	c6 40 09 00          	movb   $0x0,0x9(%eax)
  (*f0)->pipe = p;
  102c73:	8b 06                	mov    (%esi),%eax
  102c75:	89 78 0c             	mov    %edi,0xc(%eax)
  (*f1)->type = FD_PIPE;
  102c78:	8b 03                	mov    (%ebx),%eax
  102c7a:	c7 00 01 00 00 00    	movl   $0x1,(%eax)
  (*f1)->readable = 0;
  102c80:	8b 03                	mov    (%ebx),%eax
  102c82:	c6 40 08 00          	movb   $0x0,0x8(%eax)
  (*f1)->writable = 1;
  102c86:	8b 03                	mov    (%ebx),%eax
  102c88:	c6 40 09 01          	movb   $0x1,0x9(%eax)
  (*f1)->pipe = p;
  102c8c:	8b 03                	mov    (%ebx),%eax
  return 0;
  102c8e:	31 db                	xor    %ebx,%ebx
  (*f0)->writable = 0;
  (*f0)->pipe = p;
  (*f1)->type = FD_PIPE;
  (*f1)->readable = 0;
  (*f1)->writable = 1;
  (*f1)->pipe = p;
  102c90:	89 78 0c             	mov    %edi,0xc(%eax)
  if(*f0)
    fileclose(*f0);
  if(*f1)
    fileclose(*f1);
  return -1;
}
  102c93:	89 d8                	mov    %ebx,%eax
  102c95:	8b 74 24 14          	mov    0x14(%esp),%esi
  102c99:	8b 5c 24 10          	mov    0x10(%esp),%ebx
  102c9d:	8b 7c 24 18          	mov    0x18(%esp),%edi
  102ca1:	83 c4 1c             	add    $0x1c,%esp
  102ca4:	c3                   	ret    
  102ca5:	8d 76 00             	lea    0x0(%esi),%esi
  return 0;

 bad:
  if(p)
    kfree((char*)p, PAGE);
  if(*f0)
  102ca8:	8b 06                	mov    (%esi),%eax
  102caa:	85 c0                	test   %eax,%eax
  102cac:	74 08                	je     102cb6 <pipealloc+0xe6>
    fileclose(*f0);
  102cae:	89 04 24             	mov    %eax,(%esp)
  102cb1:	e8 0a e2 ff ff       	call   100ec0 <fileclose>
  if(*f1)
  102cb6:	8b 03                	mov    (%ebx),%eax
    fileclose(*f1);
  return -1;
  102cb8:	bb ff ff ff ff       	mov    $0xffffffff,%ebx
 bad:
  if(p)
    kfree((char*)p, PAGE);
  if(*f0)
    fileclose(*f0);
  if(*f1)
  102cbd:	85 c0                	test   %eax,%eax
  102cbf:	74 d2                	je     102c93 <pipealloc+0xc3>
    fileclose(*f1);
  102cc1:	89 04 24             	mov    %eax,(%esp)
  102cc4:	e8 f7 e1 ff ff       	call   100ec0 <fileclose>
  102cc9:	eb c8                	jmp    102c93 <pipealloc+0xc3>
  102ccb:	90                   	nop
  102ccc:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

00102cd0 <pipeclose>:
  return -1;
}

void
pipeclose(struct pipe *p, int writable)
{
  102cd0:	83 ec 1c             	sub    $0x1c,%esp
  102cd3:	89 5c 24 14          	mov    %ebx,0x14(%esp)
  102cd7:	8b 5c 24 20          	mov    0x20(%esp),%ebx
  102cdb:	89 74 24 18          	mov    %esi,0x18(%esp)
  102cdf:	8b 74 24 24          	mov    0x24(%esp),%esi
  acquire(&p->lock);
  102ce3:	89 1c 24             	mov    %ebx,(%esp)
  102ce6:	e8 85 0e 00 00       	call   103b70 <acquire>
  if(writable){
  102ceb:	85 f6                	test   %esi,%esi
  102ced:	74 41                	je     102d30 <pipeclose+0x60>
    p->writeopen = 0;
  102cef:	c7 83 40 02 00 00 00 	movl   $0x0,0x240(%ebx)
  102cf6:	00 00 00 
    wakeup(&p->nread);
  102cf9:	8d 83 34 02 00 00    	lea    0x234(%ebx),%eax
  102cff:	89 04 24             	mov    %eax,(%esp)
  102d02:	e8 b9 0a 00 00       	call   1037c0 <wakeup>
  } else {
    p->readopen = 0;
    wakeup(&p->nwrite);
  }
  if(p->readopen == 0 && p->writeopen == 0) {
  102d07:	8b 93 3c 02 00 00    	mov    0x23c(%ebx),%edx
  102d0d:	85 d2                	test   %edx,%edx
  102d0f:	75 0a                	jne    102d1b <pipeclose+0x4b>
  102d11:	8b 83 40 02 00 00    	mov    0x240(%ebx),%eax
  102d17:	85 c0                	test   %eax,%eax
  102d19:	74 35                	je     102d50 <pipeclose+0x80>
    release(&p->lock);
    kfree((char*)p, PAGE);
  } else
    release(&p->lock);
  102d1b:	89 5c 24 20          	mov    %ebx,0x20(%esp)
}
  102d1f:	8b 74 24 18          	mov    0x18(%esp),%esi
  102d23:	8b 5c 24 14          	mov    0x14(%esp),%ebx
  102d27:	83 c4 1c             	add    $0x1c,%esp
  }
  if(p->readopen == 0 && p->writeopen == 0) {
    release(&p->lock);
    kfree((char*)p, PAGE);
  } else
    release(&p->lock);
  102d2a:	e9 01 0f 00 00       	jmp    103c30 <release>
  102d2f:	90                   	nop
  acquire(&p->lock);
  if(writable){
    p->writeopen = 0;
    wakeup(&p->nread);
  } else {
    p->readopen = 0;
  102d30:	c7 83 3c 02 00 00 00 	movl   $0x0,0x23c(%ebx)
  102d37:	00 00 00 
    wakeup(&p->nwrite);
  102d3a:	8d 83 38 02 00 00    	lea    0x238(%ebx),%eax
  102d40:	89 04 24             	mov    %eax,(%esp)
  102d43:	e8 78 0a 00 00       	call   1037c0 <wakeup>
  102d48:	eb bd                	jmp    102d07 <pipeclose+0x37>
  102d4a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  }
  if(p->readopen == 0 && p->writeopen == 0) {
    release(&p->lock);
  102d50:	89 1c 24             	mov    %ebx,(%esp)
  102d53:	e8 d8 0e 00 00       	call   103c30 <release>
    kfree((char*)p, PAGE);
  } else
    release(&p->lock);
}
  102d58:	8b 74 24 18          	mov    0x18(%esp),%esi
    p->readopen = 0;
    wakeup(&p->nwrite);
  }
  if(p->readopen == 0 && p->writeopen == 0) {
    release(&p->lock);
    kfree((char*)p, PAGE);
  102d5c:	89 5c 24 20          	mov    %ebx,0x20(%esp)
  } else
    release(&p->lock);
}
  102d60:	8b 5c 24 14          	mov    0x14(%esp),%ebx
    p->readopen = 0;
    wakeup(&p->nwrite);
  }
  if(p->readopen == 0 && p->writeopen == 0) {
    release(&p->lock);
    kfree((char*)p, PAGE);
  102d64:	c7 44 24 24 00 10 00 	movl   $0x1000,0x24(%esp)
  102d6b:	00 
  } else
    release(&p->lock);
}
  102d6c:	83 c4 1c             	add    $0x1c,%esp
    p->readopen = 0;
    wakeup(&p->nwrite);
  }
  if(p->readopen == 0 && p->writeopen == 0) {
    release(&p->lock);
    kfree((char*)p, PAGE);
  102d6f:	e9 9c f5 ff ff       	jmp    102310 <kfree>
  102d74:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  102d7a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00102d80 <pipewrite>:
    release(&p->lock);
}

int
pipewrite(struct pipe *p, char *addr, int n)
{
  102d80:	55                   	push   %ebp
  102d81:	57                   	push   %edi
  102d82:	56                   	push   %esi
  102d83:	53                   	push   %ebx
  102d84:	83 ec 2c             	sub    $0x2c,%esp
  102d87:	8b 5c 24 40          	mov    0x40(%esp),%ebx
  102d8b:	8b 6c 24 48          	mov    0x48(%esp),%ebp
  int i;

  acquire(&p->lock);
  102d8f:	89 1c 24             	mov    %ebx,(%esp)
  102d92:	e8 d9 0d 00 00       	call   103b70 <acquire>
  for(i = 0; i < n; i++){
  102d97:	85 ed                	test   %ebp,%ebp
  102d99:	0f 8e 99 00 00 00    	jle    102e38 <pipewrite+0xb8>
  102d9f:	8b 93 38 02 00 00    	mov    0x238(%ebx),%edx
  102da5:	8d bb 34 02 00 00    	lea    0x234(%ebx),%edi
  102dab:	c7 44 24 1c 00 00 00 	movl   $0x0,0x1c(%esp)
  102db2:	00 
  102db3:	8d b3 38 02 00 00    	lea    0x238(%ebx),%esi
  102db9:	eb 3a                	jmp    102df5 <pipewrite+0x75>
  102dbb:	90                   	nop
  102dbc:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    while(p->nwrite == p->nread + PIPESIZE) {  //DOC: pipewrite-full
      if(p->readopen == 0 || proc->killed){
  102dc0:	8b 8b 3c 02 00 00    	mov    0x23c(%ebx),%ecx
  102dc6:	85 c9                	test   %ecx,%ecx
  102dc8:	0f 84 82 00 00 00    	je     102e50 <pipewrite+0xd0>
  102dce:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  102dd4:	8b 40 24             	mov    0x24(%eax),%eax
  102dd7:	85 c0                	test   %eax,%eax
  102dd9:	75 75                	jne    102e50 <pipewrite+0xd0>
        release(&p->lock);
        return -1;
      }
      wakeup(&p->nread);
  102ddb:	89 3c 24             	mov    %edi,(%esp)
  102dde:	e8 dd 09 00 00       	call   1037c0 <wakeup>
      sleep(&p->nwrite, &p->lock);  //DOC: pipewrite-sleep
  102de3:	89 5c 24 04          	mov    %ebx,0x4(%esp)
  102de7:	89 34 24             	mov    %esi,(%esp)
  102dea:	e8 11 09 00 00       	call   103700 <sleep>
{
  int i;

  acquire(&p->lock);
  for(i = 0; i < n; i++){
    while(p->nwrite == p->nread + PIPESIZE) {  //DOC: pipewrite-full
  102def:	8b 93 38 02 00 00    	mov    0x238(%ebx),%edx
  102df5:	8b 83 34 02 00 00    	mov    0x234(%ebx),%eax
  102dfb:	05 00 02 00 00       	add    $0x200,%eax
  102e00:	39 c2                	cmp    %eax,%edx
  102e02:	74 bc                	je     102dc0 <pipewrite+0x40>
        return -1;
      }
      wakeup(&p->nread);
      sleep(&p->nwrite, &p->lock);  //DOC: pipewrite-sleep
    }
    p->data[p->nwrite++ % PIPESIZE] = addr[i];
  102e04:	8b 4c 24 44          	mov    0x44(%esp),%ecx
  102e08:	8b 44 24 1c          	mov    0x1c(%esp),%eax
pipewrite(struct pipe *p, char *addr, int n)
{
  int i;

  acquire(&p->lock);
  for(i = 0; i < n; i++){
  102e0c:	83 44 24 1c 01       	addl   $0x1,0x1c(%esp)
        return -1;
      }
      wakeup(&p->nread);
      sleep(&p->nwrite, &p->lock);  //DOC: pipewrite-sleep
    }
    p->data[p->nwrite++ % PIPESIZE] = addr[i];
  102e11:	0f b6 04 01          	movzbl (%ecx,%eax,1),%eax
  102e15:	88 44 24 1b          	mov    %al,0x1b(%esp)
  102e19:	89 d0                	mov    %edx,%eax
  102e1b:	0f b6 4c 24 1b       	movzbl 0x1b(%esp),%ecx
  102e20:	25 ff 01 00 00       	and    $0x1ff,%eax
  102e25:	83 c2 01             	add    $0x1,%edx
pipewrite(struct pipe *p, char *addr, int n)
{
  int i;

  acquire(&p->lock);
  for(i = 0; i < n; i++){
  102e28:	39 6c 24 1c          	cmp    %ebp,0x1c(%esp)
        return -1;
      }
      wakeup(&p->nread);
      sleep(&p->nwrite, &p->lock);  //DOC: pipewrite-sleep
    }
    p->data[p->nwrite++ % PIPESIZE] = addr[i];
  102e2c:	88 4c 03 34          	mov    %cl,0x34(%ebx,%eax,1)
  102e30:	89 93 38 02 00 00    	mov    %edx,0x238(%ebx)
pipewrite(struct pipe *p, char *addr, int n)
{
  int i;

  acquire(&p->lock);
  for(i = 0; i < n; i++){
  102e36:	75 bd                	jne    102df5 <pipewrite+0x75>
      wakeup(&p->nread);
      sleep(&p->nwrite, &p->lock);  //DOC: pipewrite-sleep
    }
    p->data[p->nwrite++ % PIPESIZE] = addr[i];
  }
  wakeup(&p->nread);  //DOC: pipewrite-wakeup1
  102e38:	8d 83 34 02 00 00    	lea    0x234(%ebx),%eax
  102e3e:	89 04 24             	mov    %eax,(%esp)
  102e41:	e8 7a 09 00 00       	call   1037c0 <wakeup>
  release(&p->lock);
  102e46:	89 1c 24             	mov    %ebx,(%esp)
  102e49:	e8 e2 0d 00 00       	call   103c30 <release>
  return n;
  102e4e:	eb 0d                	jmp    102e5d <pipewrite+0xdd>

  acquire(&p->lock);
  for(i = 0; i < n; i++){
    while(p->nwrite == p->nread + PIPESIZE) {  //DOC: pipewrite-full
      if(p->readopen == 0 || proc->killed){
        release(&p->lock);
  102e50:	89 1c 24             	mov    %ebx,(%esp)
        return -1;
  102e53:	bd ff ff ff ff       	mov    $0xffffffff,%ebp

  acquire(&p->lock);
  for(i = 0; i < n; i++){
    while(p->nwrite == p->nread + PIPESIZE) {  //DOC: pipewrite-full
      if(p->readopen == 0 || proc->killed){
        release(&p->lock);
  102e58:	e8 d3 0d 00 00       	call   103c30 <release>
    p->data[p->nwrite++ % PIPESIZE] = addr[i];
  }
  wakeup(&p->nread);  //DOC: pipewrite-wakeup1
  release(&p->lock);
  return n;
}
  102e5d:	83 c4 2c             	add    $0x2c,%esp
  102e60:	89 e8                	mov    %ebp,%eax
  102e62:	5b                   	pop    %ebx
  102e63:	5e                   	pop    %esi
  102e64:	5f                   	pop    %edi
  102e65:	5d                   	pop    %ebp
  102e66:	c3                   	ret    
  102e67:	89 f6                	mov    %esi,%esi
  102e69:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00102e70 <piperead>:

int
piperead(struct pipe *p, char *addr, int n)
{
  102e70:	57                   	push   %edi
  102e71:	56                   	push   %esi
  102e72:	53                   	push   %ebx
  102e73:	83 ec 10             	sub    $0x10,%esp
  102e76:	8b 5c 24 20          	mov    0x20(%esp),%ebx
  102e7a:	8b 7c 24 28          	mov    0x28(%esp),%edi
  int i;

  acquire(&p->lock);
  102e7e:	89 1c 24             	mov    %ebx,(%esp)
  102e81:	e8 ea 0c 00 00       	call   103b70 <acquire>
  while(p->nread == p->nwrite && p->writeopen){  //DOC: pipe-empty
  102e86:	8b 93 34 02 00 00    	mov    0x234(%ebx),%edx
  102e8c:	3b 93 38 02 00 00    	cmp    0x238(%ebx),%edx
  102e92:	75 55                	jne    102ee9 <piperead+0x79>
  102e94:	8b 83 40 02 00 00    	mov    0x240(%ebx),%eax
  102e9a:	85 c0                	test   %eax,%eax
  102e9c:	74 4b                	je     102ee9 <piperead+0x79>
    if(proc->killed){
  102e9e:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  102ea4:	8d b3 34 02 00 00    	lea    0x234(%ebx),%esi
  102eaa:	8b 40 24             	mov    0x24(%eax),%eax
  102ead:	85 c0                	test   %eax,%eax
  102eaf:	74 1e                	je     102ecf <piperead+0x5f>
  102eb1:	e9 92 00 00 00       	jmp    102f48 <piperead+0xd8>
  102eb6:	66 90                	xchg   %ax,%ax
piperead(struct pipe *p, char *addr, int n)
{
  int i;

  acquire(&p->lock);
  while(p->nread == p->nwrite && p->writeopen){  //DOC: pipe-empty
  102eb8:	8b 83 40 02 00 00    	mov    0x240(%ebx),%eax
  102ebe:	85 c0                	test   %eax,%eax
  102ec0:	74 27                	je     102ee9 <piperead+0x79>
    if(proc->killed){
  102ec2:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  102ec8:	8b 40 24             	mov    0x24(%eax),%eax
  102ecb:	85 c0                	test   %eax,%eax
  102ecd:	75 79                	jne    102f48 <piperead+0xd8>
      release(&p->lock);
      return -1;
    }
    sleep(&p->nread, &p->lock); //DOC: piperead-sleep
  102ecf:	89 5c 24 04          	mov    %ebx,0x4(%esp)
  102ed3:	89 34 24             	mov    %esi,(%esp)
  102ed6:	e8 25 08 00 00       	call   103700 <sleep>
piperead(struct pipe *p, char *addr, int n)
{
  int i;

  acquire(&p->lock);
  while(p->nread == p->nwrite && p->writeopen){  //DOC: pipe-empty
  102edb:	8b 93 34 02 00 00    	mov    0x234(%ebx),%edx
  102ee1:	3b 93 38 02 00 00    	cmp    0x238(%ebx),%edx
  102ee7:	74 cf                	je     102eb8 <piperead+0x48>
      release(&p->lock);
      return -1;
    }
    sleep(&p->nread, &p->lock); //DOC: piperead-sleep
  }
  for(i = 0; i < n; i++){  //DOC: piperead-copy
  102ee9:	31 f6                	xor    %esi,%esi
  102eeb:	85 ff                	test   %edi,%edi
  102eed:	7e 38                	jle    102f27 <piperead+0xb7>
    if(p->nread == p->nwrite)
  102eef:	3b 93 38 02 00 00    	cmp    0x238(%ebx),%edx
  102ef5:	74 30                	je     102f27 <piperead+0xb7>
  release(&p->lock);
  return n;
}

int
piperead(struct pipe *p, char *addr, int n)
  102ef7:	8b 4c 24 24          	mov    0x24(%esp),%ecx
  102efb:	29 d1                	sub    %edx,%ecx
  102efd:	eb 09                	jmp    102f08 <piperead+0x98>
  102eff:	90                   	nop
      return -1;
    }
    sleep(&p->nread, &p->lock); //DOC: piperead-sleep
  }
  for(i = 0; i < n; i++){  //DOC: piperead-copy
    if(p->nread == p->nwrite)
  102f00:	39 93 38 02 00 00    	cmp    %edx,0x238(%ebx)
  102f06:	74 1f                	je     102f27 <piperead+0xb7>
      break;
    addr[i] = p->data[p->nread++ % PIPESIZE];
  102f08:	89 d0                	mov    %edx,%eax
      release(&p->lock);
      return -1;
    }
    sleep(&p->nread, &p->lock); //DOC: piperead-sleep
  }
  for(i = 0; i < n; i++){  //DOC: piperead-copy
  102f0a:	83 c6 01             	add    $0x1,%esi
    if(p->nread == p->nwrite)
      break;
    addr[i] = p->data[p->nread++ % PIPESIZE];
  102f0d:	25 ff 01 00 00       	and    $0x1ff,%eax
  102f12:	0f b6 44 03 34       	movzbl 0x34(%ebx,%eax,1),%eax
  102f17:	88 04 11             	mov    %al,(%ecx,%edx,1)
  102f1a:	83 c2 01             	add    $0x1,%edx
      release(&p->lock);
      return -1;
    }
    sleep(&p->nread, &p->lock); //DOC: piperead-sleep
  }
  for(i = 0; i < n; i++){  //DOC: piperead-copy
  102f1d:	39 fe                	cmp    %edi,%esi
    if(p->nread == p->nwrite)
      break;
    addr[i] = p->data[p->nread++ % PIPESIZE];
  102f1f:	89 93 34 02 00 00    	mov    %edx,0x234(%ebx)
      release(&p->lock);
      return -1;
    }
    sleep(&p->nread, &p->lock); //DOC: piperead-sleep
  }
  for(i = 0; i < n; i++){  //DOC: piperead-copy
  102f25:	75 d9                	jne    102f00 <piperead+0x90>
    if(p->nread == p->nwrite)
      break;
    addr[i] = p->data[p->nread++ % PIPESIZE];
  }
  wakeup(&p->nwrite);  //DOC: piperead-wakeup
  102f27:	8d 83 38 02 00 00    	lea    0x238(%ebx),%eax
  102f2d:	89 04 24             	mov    %eax,(%esp)
  102f30:	e8 8b 08 00 00       	call   1037c0 <wakeup>
  release(&p->lock);
  102f35:	89 1c 24             	mov    %ebx,(%esp)
  102f38:	e8 f3 0c 00 00       	call   103c30 <release>
  return i;
}
  102f3d:	83 c4 10             	add    $0x10,%esp
  102f40:	89 f0                	mov    %esi,%eax
  102f42:	5b                   	pop    %ebx
  102f43:	5e                   	pop    %esi
  102f44:	5f                   	pop    %edi
  102f45:	c3                   	ret    
  102f46:	66 90                	xchg   %ax,%ax
  int i;

  acquire(&p->lock);
  while(p->nread == p->nwrite && p->writeopen){  //DOC: pipe-empty
    if(proc->killed){
      release(&p->lock);
  102f48:	89 1c 24             	mov    %ebx,(%esp)
      return -1;
  102f4b:	be ff ff ff ff       	mov    $0xffffffff,%esi
  int i;

  acquire(&p->lock);
  while(p->nread == p->nwrite && p->writeopen){  //DOC: pipe-empty
    if(proc->killed){
      release(&p->lock);
  102f50:	e8 db 0c 00 00       	call   103c30 <release>
    addr[i] = p->data[p->nread++ % PIPESIZE];
  }
  wakeup(&p->nwrite);  //DOC: piperead-wakeup
  release(&p->lock);
  return i;
}
  102f55:	83 c4 10             	add    $0x10,%esp
  102f58:	89 f0                	mov    %esi,%eax
  102f5a:	5b                   	pop    %ebx
  102f5b:	5e                   	pop    %esi
  102f5c:	5f                   	pop    %edi
  102f5d:	c3                   	ret    
  102f5e:	90                   	nop
  102f5f:	90                   	nop

00102f60 <forkret>:

// A fork child's very first scheduling by scheduler()
// will swtch here.  "Return" to user space.
void
forkret(void)
{
  102f60:	83 ec 1c             	sub    $0x1c,%esp
  // Still holding ptable.lock from scheduler.
  release(&ptable.lock);
  102f63:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
  102f6a:	e8 c1 0c 00 00       	call   103c30 <release>
  
  // Return to "caller", actually trapret (see allocproc).
}
  102f6f:	83 c4 1c             	add    $0x1c,%esp
  102f72:	c3                   	ret    
  102f73:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  102f79:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00102f80 <allocproc>:
// Look in the process table for an UNUSED proc.
// If found, change state to EMBRYO and return it.
// Otherwise return 0.
static struct proc*
allocproc(void)
{
  102f80:	53                   	push   %ebx
  struct proc *p;
  char *sp;

  acquire(&ptable.lock);
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
  102f81:	bb b4 c0 10 00       	mov    $0x10c0b4,%ebx
// Look in the process table for an UNUSED proc.
// If found, change state to EMBRYO and return it.
// Otherwise return 0.
static struct proc*
allocproc(void)
{
  102f86:	83 ec 18             	sub    $0x18,%esp
  struct proc *p;
  char *sp;

  acquire(&ptable.lock);
  102f89:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
  102f90:	e8 db 0b 00 00       	call   103b70 <acquire>
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
    if(p->state == UNUSED)
  102f95:	8b 15 c0 c0 10 00    	mov    0x10c0c0,%edx
  102f9b:	85 d2                	test   %edx,%edx
  102f9d:	74 17                	je     102fb6 <allocproc+0x36>
  102f9f:	90                   	nop
{
  struct proc *p;
  char *sp;

  acquire(&ptable.lock);
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
  102fa0:	83 c3 7c             	add    $0x7c,%ebx
  102fa3:	81 fb b4 df 10 00    	cmp    $0x10dfb4,%ebx
  102fa9:	0f 83 81 00 00 00    	jae    103030 <allocproc+0xb0>
    if(p->state == UNUSED)
  102faf:	8b 43 0c             	mov    0xc(%ebx),%eax
  102fb2:	85 c0                	test   %eax,%eax
  102fb4:	75 ea                	jne    102fa0 <allocproc+0x20>
  release(&ptable.lock);
  return 0;

found:
  p->state = EMBRYO;
  p->pid = nextpid++;
  102fb6:	a1 04 83 10 00       	mov    0x108304,%eax
      goto found;
  release(&ptable.lock);
  return 0;

found:
  p->state = EMBRYO;
  102fbb:	c7 43 0c 01 00 00 00 	movl   $0x1,0xc(%ebx)
  p->pid = nextpid++;
  102fc2:	89 43 10             	mov    %eax,0x10(%ebx)
  102fc5:	83 c0 01             	add    $0x1,%eax
  102fc8:	a3 04 83 10 00       	mov    %eax,0x108304
  release(&ptable.lock);
  102fcd:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
  102fd4:	e8 57 0c 00 00       	call   103c30 <release>

  // Allocate kernel stack if necessary.
  if((p->kstack = kalloc(KSTACKSIZE)) == 0){
  102fd9:	c7 04 24 00 10 00 00 	movl   $0x1000,(%esp)
  102fe0:	e8 9b f4 ff ff       	call   102480 <kalloc>
  102fe5:	85 c0                	test   %eax,%eax
  102fe7:	89 43 08             	mov    %eax,0x8(%ebx)
  102fea:	74 59                	je     103045 <allocproc+0xc5>
    return 0;
  }
  sp = p->kstack + KSTACKSIZE;
  
  // Leave room for trap frame.
  sp -= sizeof *p->tf;
  102fec:	8d 90 b4 0f 00 00    	lea    0xfb4(%eax),%edx
  102ff2:	89 53 18             	mov    %edx,0x18(%ebx)
  p->tf = (struct trapframe*)sp;
  
  // Set up new context to start executing at forkret,
  // which returns to trapret (see below).
  sp -= 4;
  *(uint*)sp = (uint)trapret;
  102ff5:	c7 80 b0 0f 00 00 ec 	movl   $0x104dec,0xfb0(%eax)
  102ffc:	4d 10 00 

  sp -= sizeof *p->context;
  102fff:	05 9c 0f 00 00       	add    $0xf9c,%eax
  p->context = (struct context*)sp;
  103004:	89 43 1c             	mov    %eax,0x1c(%ebx)
  memset(p->context, 0, sizeof *p->context);
  103007:	c7 44 24 08 14 00 00 	movl   $0x14,0x8(%esp)
  10300e:	00 
  10300f:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  103016:	00 
  103017:	89 04 24             	mov    %eax,(%esp)
  10301a:	e8 61 0c 00 00       	call   103c80 <memset>
  p->context->eip = (uint)forkret;
  10301f:	8b 43 1c             	mov    0x1c(%ebx),%eax
  103022:	c7 40 10 60 2f 10 00 	movl   $0x102f60,0x10(%eax)
  return p;
}
  103029:	83 c4 18             	add    $0x18,%esp
  10302c:	89 d8                	mov    %ebx,%eax
  10302e:	5b                   	pop    %ebx
  10302f:	c3                   	ret    

  acquire(&ptable.lock);
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
    if(p->state == UNUSED)
      goto found;
  release(&ptable.lock);
  103030:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
  return 0;
  103037:	31 db                	xor    %ebx,%ebx

  acquire(&ptable.lock);
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
    if(p->state == UNUSED)
      goto found;
  release(&ptable.lock);
  103039:	e8 f2 0b 00 00       	call   103c30 <release>
  sp -= sizeof *p->context;
  p->context = (struct context*)sp;
  memset(p->context, 0, sizeof *p->context);
  p->context->eip = (uint)forkret;
  return p;
}
  10303e:	83 c4 18             	add    $0x18,%esp
  103041:	89 d8                	mov    %ebx,%eax
  103043:	5b                   	pop    %ebx
  103044:	c3                   	ret    
  p->pid = nextpid++;
  release(&ptable.lock);

  // Allocate kernel stack if necessary.
  if((p->kstack = kalloc(KSTACKSIZE)) == 0){
    p->state = UNUSED;
  103045:	c7 43 0c 00 00 00 00 	movl   $0x0,0xc(%ebx)
    return 0;
  10304c:	31 db                	xor    %ebx,%ebx
  10304e:	eb d9                	jmp    103029 <allocproc+0xa9>

00103050 <pinit>:
extern void forkret(void);
extern void trapret(void);

void
pinit(void)
{
  103050:	83 ec 1c             	sub    $0x1c,%esp
  initlock(&ptable.lock, "ptable");
  103053:	c7 44 24 04 cd 61 10 	movl   $0x1061cd,0x4(%esp)
  10305a:	00 
  10305b:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
  103062:	e8 49 0a 00 00       	call   103ab0 <initlock>
}
  103067:	83 c4 1c             	add    $0x1c,%esp
  10306a:	c3                   	ret    
  10306b:	90                   	nop
  10306c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

00103070 <procdump>:
// Print a process listing to console.  For debugging.
// Runs when user types ^P on console.
// No lock to avoid wedging a stuck machine further.
void
procdump(void)
{
  103070:	55                   	push   %ebp
  103071:	57                   	push   %edi
  103072:	56                   	push   %esi
  103073:	53                   	push   %ebx
  int i;
  struct proc *p;
  char *state;
  uint pc[10];
  
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
  103074:	bb b4 c0 10 00       	mov    $0x10c0b4,%ebx
// Print a process listing to console.  For debugging.
// Runs when user types ^P on console.
// No lock to avoid wedging a stuck machine further.
void
procdump(void)
{
  103079:	83 ec 4c             	sub    $0x4c,%esp
      state = states[p->state];
    else
      state = "???";
    cprintf("%d %s %s", p->pid, state, p->name);
    if(p->state == SLEEPING){
      getcallerpcs((uint*)p->context->ebp+2, pc);
  10307c:	8d 6c 24 18          	lea    0x18(%esp),%ebp

// Print a process listing to console.  For debugging.
// Runs when user types ^P on console.
// No lock to avoid wedging a stuck machine further.
void
procdump(void)
  103080:	8d 7c 24 40          	lea    0x40(%esp),%edi
  103084:	eb 1d                	jmp    1030a3 <procdump+0x33>
  103086:	66 90                	xchg   %ax,%ax
    if(p->state == SLEEPING){
      getcallerpcs((uint*)p->context->ebp+2, pc);
      for(i=0; i<10 && pc[i] != 0; i++)
        cprintf(" %p", pc[i]);
    }
    cprintf("\n");
  103088:	c7 04 24 63 61 10 00 	movl   $0x106163,(%esp)
  10308f:	e8 bc d5 ff ff       	call   100650 <cprintf>
  int i;
  struct proc *p;
  char *state;
  uint pc[10];
  
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
  103094:	83 c3 7c             	add    $0x7c,%ebx
  103097:	81 fb b4 df 10 00    	cmp    $0x10dfb4,%ebx
  10309d:	0f 83 95 00 00 00    	jae    103138 <procdump+0xc8>
    if(p->state == UNUSED)
  1030a3:	8b 43 0c             	mov    0xc(%ebx),%eax
  1030a6:	85 c0                	test   %eax,%eax
  1030a8:	74 ea                	je     103094 <procdump+0x24>
      continue;
    if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
  1030aa:	83 f8 05             	cmp    $0x5,%eax
      state = states[p->state];
    else
      state = "???";
  1030ad:	ba d4 61 10 00       	mov    $0x1061d4,%edx
  uint pc[10];
  
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
    if(p->state == UNUSED)
      continue;
    if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
  1030b2:	77 0b                	ja     1030bf <procdump+0x4f>
  1030b4:	8b 14 85 88 62 10 00 	mov    0x106288(,%eax,4),%edx
  1030bb:	85 d2                	test   %edx,%edx
  1030bd:	74 69                	je     103128 <procdump+0xb8>
      state = states[p->state];
    else
      state = "???";
    cprintf("%d %s %s", p->pid, state, p->name);
  1030bf:	8b 43 10             	mov    0x10(%ebx),%eax
  1030c2:	8d 4b 6c             	lea    0x6c(%ebx),%ecx
  1030c5:	89 4c 24 0c          	mov    %ecx,0xc(%esp)
  1030c9:	89 54 24 08          	mov    %edx,0x8(%esp)
  1030cd:	c7 04 24 d8 61 10 00 	movl   $0x1061d8,(%esp)
  1030d4:	89 44 24 04          	mov    %eax,0x4(%esp)
  1030d8:	e8 73 d5 ff ff       	call   100650 <cprintf>
    if(p->state == SLEEPING){
  1030dd:	83 7b 0c 02          	cmpl   $0x2,0xc(%ebx)
  1030e1:	75 a5                	jne    103088 <procdump+0x18>
      getcallerpcs((uint*)p->context->ebp+2, pc);
  1030e3:	8b 43 1c             	mov    0x1c(%ebx),%eax
  1030e6:	89 ee                	mov    %ebp,%esi
  1030e8:	89 6c 24 04          	mov    %ebp,0x4(%esp)
  1030ec:	8b 40 0c             	mov    0xc(%eax),%eax
  1030ef:	83 c0 08             	add    $0x8,%eax
  1030f2:	89 04 24             	mov    %eax,(%esp)
  1030f5:	e8 d6 09 00 00       	call   103ad0 <getcallerpcs>
  1030fa:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
      for(i=0; i<10 && pc[i] != 0; i++)
  103100:	8b 06                	mov    (%esi),%eax
  103102:	85 c0                	test   %eax,%eax
  103104:	74 82                	je     103088 <procdump+0x18>
        cprintf(" %p", pc[i]);
  103106:	83 c6 04             	add    $0x4,%esi
  103109:	89 44 24 04          	mov    %eax,0x4(%esp)
  10310d:	c7 04 24 fc 5c 10 00 	movl   $0x105cfc,(%esp)
  103114:	e8 37 d5 ff ff       	call   100650 <cprintf>
    else
      state = "???";
    cprintf("%d %s %s", p->pid, state, p->name);
    if(p->state == SLEEPING){
      getcallerpcs((uint*)p->context->ebp+2, pc);
      for(i=0; i<10 && pc[i] != 0; i++)
  103119:	39 fe                	cmp    %edi,%esi
  10311b:	75 e3                	jne    103100 <procdump+0x90>
  10311d:	e9 66 ff ff ff       	jmp    103088 <procdump+0x18>
  103122:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    if(p->state == UNUSED)
      continue;
    if(p->state >= 0 && p->state < NELEM(states) && states[p->state])
      state = states[p->state];
    else
      state = "???";
  103128:	ba d4 61 10 00       	mov    $0x1061d4,%edx
  10312d:	8d 76 00             	lea    0x0(%esi),%esi
  103130:	eb 8d                	jmp    1030bf <procdump+0x4f>
  103132:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
      for(i=0; i<10 && pc[i] != 0; i++)
        cprintf(" %p", pc[i]);
    }
    cprintf("\n");
  }
}
  103138:	83 c4 4c             	add    $0x4c,%esp
  10313b:	5b                   	pop    %ebx
  10313c:	5e                   	pop    %esi
  10313d:	5f                   	pop    %edi
  10313e:	5d                   	pop    %ebp
  10313f:	c3                   	ret    

00103140 <ksegment>:

// Set up CPU's kernel segment descriptors.
// Run once at boot time on each CPU.
void
ksegment(void)
{
  103140:	83 ec 1c             	sub    $0x1c,%esp
  struct cpu *c;

  c = &cpus[cpunum()];
  103143:	e8 a8 f5 ff ff       	call   1026f0 <cpunum>
  103148:	69 c0 bc 00 00 00    	imul   $0xbc,%eax,%eax
  10314e:	05 80 ba 10 00       	add    $0x10ba80,%eax
  c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0x100000 + 64*1024-1, 0);
  c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
  c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0);
  103153:	8d 90 b4 00 00 00    	lea    0xb4(%eax),%edx
  103159:	66 89 90 8a 00 00 00 	mov    %dx,0x8a(%eax)
  103160:	89 d1                	mov    %edx,%ecx
  103162:	c1 ea 18             	shr    $0x18,%edx
  103165:	88 90 8f 00 00 00    	mov    %dl,0x8f(%eax)
  lgdt(c->gdt, sizeof(c->gdt));
  10316b:	8d 50 70             	lea    0x70(%eax),%edx
ksegment(void)
{
  struct cpu *c;

  c = &cpus[cpunum()];
  c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0x100000 + 64*1024-1, 0);
  10316e:	c6 40 7d 9a          	movb   $0x9a,0x7d(%eax)
  c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
  c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0);
  103172:	c1 e9 10             	shr    $0x10,%ecx
ksegment(void)
{
  struct cpu *c;

  c = &cpus[cpunum()];
  c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0x100000 + 64*1024-1, 0);
  103175:	c6 40 7e c0          	movb   $0xc0,0x7e(%eax)
  c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
  103179:	c6 80 85 00 00 00 92 	movb   $0x92,0x85(%eax)
  103180:	c6 80 86 00 00 00 cf 	movb   $0xcf,0x86(%eax)
  c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0);
  103187:	c6 80 8d 00 00 00 92 	movb   $0x92,0x8d(%eax)
  10318e:	c6 80 8e 00 00 00 c0 	movb   $0xc0,0x8e(%eax)
static inline void
lgdt(struct segdesc *p, int size)
{
  volatile ushort pd[3];

  pd[0] = size-1;
  103195:	66 c7 44 24 0a 37 00 	movw   $0x37,0xa(%esp)
  pd[1] = (uint)p;
  10319c:	66 89 54 24 0c       	mov    %dx,0xc(%esp)
  pd[2] = (uint)p >> 16;
  1031a1:	c1 ea 10             	shr    $0x10,%edx
  1031a4:	66 89 54 24 0e       	mov    %dx,0xe(%esp)

  asm volatile("lgdt (%0)" : : "r" (pd));
  1031a9:	8d 54 24 0a          	lea    0xa(%esp),%edx
ksegment(void)
{
  struct cpu *c;

  c = &cpus[cpunum()];
  c->gdt[SEG_KCODE] = SEG(STA_X|STA_R, 0, 0x100000 + 64*1024-1, 0);
  1031ad:	66 c7 40 78 0f 01    	movw   $0x10f,0x78(%eax)
  1031b3:	66 c7 40 7a 00 00    	movw   $0x0,0x7a(%eax)
  1031b9:	c6 40 7c 00          	movb   $0x0,0x7c(%eax)
  1031bd:	c6 40 7f 00          	movb   $0x0,0x7f(%eax)
  c->gdt[SEG_KDATA] = SEG(STA_W, 0, 0xffffffff, 0);
  1031c1:	66 c7 80 80 00 00 00 	movw   $0xffff,0x80(%eax)
  1031c8:	ff ff 
  1031ca:	66 c7 80 82 00 00 00 	movw   $0x0,0x82(%eax)
  1031d1:	00 00 
  1031d3:	c6 80 84 00 00 00 00 	movb   $0x0,0x84(%eax)
  1031da:	c6 80 87 00 00 00 00 	movb   $0x0,0x87(%eax)
  c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0);
  1031e1:	66 c7 80 88 00 00 00 	movw   $0x0,0x88(%eax)
  1031e8:	00 00 
  1031ea:	88 88 8c 00 00 00    	mov    %cl,0x8c(%eax)
  lgdt(c->gdt, sizeof(c->gdt));
  loadgs(SEG_KCPU << 3);
  
  // Initialize cpu-local storage.
  cpu = c;
  proc = 0;
  1031f0:	65 c7 05 04 00 00 00 	movl   $0x0,%gs:0x4
  1031f7:	00 00 00 00 
  1031fb:	0f 01 12             	lgdtl  (%edx)
}

static inline void
loadgs(ushort v)
{
  asm volatile("movw %0, %%gs" : : "r" (v));
  1031fe:	ba 18 00 00 00       	mov    $0x18,%edx
  103203:	8e ea                	mov    %edx,%gs
  c->gdt[SEG_KCPU] = SEG(STA_W, &c->cpu, 8, 0);
  lgdt(c->gdt, sizeof(c->gdt));
  loadgs(SEG_KCPU << 3);
  
  // Initialize cpu-local storage.
  cpu = c;
  103205:	65 a3 00 00 00 00    	mov    %eax,%gs:0x0
  proc = 0;
}
  10320b:	83 c4 1c             	add    $0x1c,%esp
  10320e:	c3                   	ret    
  10320f:	90                   	nop

00103210 <usegment>:

// Set up CPU's segment descriptors and current process task state.
void
usegment(void)
{
  103210:	57                   	push   %edi
  103211:	56                   	push   %esi
  103212:	53                   	push   %ebx
  pushcli();
  103213:	e8 28 09 00 00       	call   103b40 <pushcli>
  cpu->gdt[SEG_UCODE] = SEG(STA_X|STA_R, proc->mem, proc->sz-1, DPL_USER);
  103218:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
  10321f:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
  103225:	8b 5a 04             	mov    0x4(%edx),%ebx
  103228:	8b 0a                	mov    (%edx),%ecx
  10322a:	c6 80 95 00 00 00 fa 	movb   $0xfa,0x95(%eax)
  103231:	8d 7b ff             	lea    -0x1(%ebx),%edi
  103234:	89 fe                	mov    %edi,%esi
  103236:	c1 ee 0c             	shr    $0xc,%esi
  103239:	66 89 b0 90 00 00 00 	mov    %si,0x90(%eax)
  103240:	89 ce                	mov    %ecx,%esi
  103242:	c1 ee 10             	shr    $0x10,%esi
  103245:	89 f3                	mov    %esi,%ebx
  103247:	88 98 94 00 00 00    	mov    %bl,0x94(%eax)
  10324d:	89 fb                	mov    %edi,%ebx
  10324f:	c1 eb 1c             	shr    $0x1c,%ebx
  103252:	66 89 88 92 00 00 00 	mov    %cx,0x92(%eax)
  103259:	83 cb c0             	or     $0xffffffc0,%ebx
  10325c:	c1 e9 18             	shr    $0x18,%ecx
  10325f:	88 98 96 00 00 00    	mov    %bl,0x96(%eax)
  103265:	88 88 97 00 00 00    	mov    %cl,0x97(%eax)
  cpu->gdt[SEG_UDATA] = SEG(STA_W, proc->mem, proc->sz-1, DPL_USER);
  10326b:	8b 5a 04             	mov    0x4(%edx),%ebx
  10326e:	8b 0a                	mov    (%edx),%ecx
  103270:	c6 80 9d 00 00 00 f2 	movb   $0xf2,0x9d(%eax)
  cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0);
  103277:	66 c7 80 a0 00 00 00 	movw   $0x67,0xa0(%eax)
  10327e:	67 00 
void
usegment(void)
{
  pushcli();
  cpu->gdt[SEG_UCODE] = SEG(STA_X|STA_R, proc->mem, proc->sz-1, DPL_USER);
  cpu->gdt[SEG_UDATA] = SEG(STA_W, proc->mem, proc->sz-1, DPL_USER);
  103280:	8d 7b ff             	lea    -0x1(%ebx),%edi
  103283:	89 fe                	mov    %edi,%esi
  103285:	c1 ee 0c             	shr    $0xc,%esi
  103288:	66 89 b0 98 00 00 00 	mov    %si,0x98(%eax)
  10328f:	89 ce                	mov    %ecx,%esi
  103291:	c1 ee 10             	shr    $0x10,%esi
  103294:	89 f3                	mov    %esi,%ebx
  103296:	88 98 9c 00 00 00    	mov    %bl,0x9c(%eax)
  10329c:	89 fb                	mov    %edi,%ebx
  10329e:	66 89 88 9a 00 00 00 	mov    %cx,0x9a(%eax)
  1032a5:	c1 eb 1c             	shr    $0x1c,%ebx
  1032a8:	c1 e9 18             	shr    $0x18,%ecx
  1032ab:	83 cb c0             	or     $0xffffffc0,%ebx
  1032ae:	88 88 9f 00 00 00    	mov    %cl,0x9f(%eax)
  cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0);
  1032b4:	8d 48 08             	lea    0x8(%eax),%ecx
void
usegment(void)
{
  pushcli();
  cpu->gdt[SEG_UCODE] = SEG(STA_X|STA_R, proc->mem, proc->sz-1, DPL_USER);
  cpu->gdt[SEG_UDATA] = SEG(STA_W, proc->mem, proc->sz-1, DPL_USER);
  1032b7:	88 98 9e 00 00 00    	mov    %bl,0x9e(%eax)
  cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0);
  1032bd:	89 cb                	mov    %ecx,%ebx
  1032bf:	66 89 88 a2 00 00 00 	mov    %cx,0xa2(%eax)
  1032c6:	c1 eb 10             	shr    $0x10,%ebx
  1032c9:	c1 e9 18             	shr    $0x18,%ecx
  1032cc:	88 98 a4 00 00 00    	mov    %bl,0xa4(%eax)
  1032d2:	88 88 a7 00 00 00    	mov    %cl,0xa7(%eax)
  1032d8:	c6 80 a6 00 00 00 40 	movb   $0x40,0xa6(%eax)
  cpu->gdt[SEG_TSS].s = 0;
  1032df:	c6 80 a5 00 00 00 89 	movb   $0x89,0xa5(%eax)
  cpu->ts.ss0 = SEG_KDATA << 3;
  1032e6:	66 c7 40 10 10 00    	movw   $0x10,0x10(%eax)
  cpu->ts.esp0 = (uint)proc->kstack + KSTACKSIZE;
  1032ec:	8b 52 08             	mov    0x8(%edx),%edx
  1032ef:	81 c2 00 10 00 00    	add    $0x1000,%edx
  1032f5:	89 50 0c             	mov    %edx,0xc(%eax)
}

static inline void
ltr(ushort sel)
{
  asm volatile("ltr %0" : : "r" (sel));
  1032f8:	b8 30 00 00 00       	mov    $0x30,%eax
  1032fd:	0f 00 d8             	ltr    %ax
  ltr(SEG_TSS << 3);
  popcli();
}
  103300:	5b                   	pop    %ebx
  103301:	5e                   	pop    %esi
  103302:	5f                   	pop    %edi
  cpu->gdt[SEG_TSS] = SEG16(STS_T32A, &cpu->ts, sizeof(cpu->ts)-1, 0);
  cpu->gdt[SEG_TSS].s = 0;
  cpu->ts.ss0 = SEG_KDATA << 3;
  cpu->ts.esp0 = (uint)proc->kstack + KSTACKSIZE;
  ltr(SEG_TSS << 3);
  popcli();
  103303:	e9 d8 08 00 00       	jmp    103be0 <popcli>
  103308:	90                   	nop
  103309:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi

00103310 <userinit>:
}

// Set up first user process.
void
userinit(void)
{
  103310:	53                   	push   %ebx
  103311:	83 ec 18             	sub    $0x18,%esp
  struct proc *p;
  extern char _binary_initcode_start[], _binary_initcode_size[];
  
  p = allocproc();
  103314:	e8 67 fc ff ff       	call   102f80 <allocproc>
  initproc = p;

  // Initialize memory from initcode.S
  p->sz = PAGE;
  103319:	c7 40 04 00 10 00 00 	movl   $0x1000,0x4(%eax)
userinit(void)
{
  struct proc *p;
  extern char _binary_initcode_start[], _binary_initcode_size[];
  
  p = allocproc();
  103320:	89 c3                	mov    %eax,%ebx
  initproc = p;

  // Initialize memory from initcode.S
  p->sz = PAGE;
  p->mem = kalloc(p->sz);
  103322:	c7 04 24 00 10 00 00 	movl   $0x1000,(%esp)
{
  struct proc *p;
  extern char _binary_initcode_start[], _binary_initcode_size[];
  
  p = allocproc();
  initproc = p;
  103329:	a3 28 88 10 00       	mov    %eax,0x108828

  // Initialize memory from initcode.S
  p->sz = PAGE;
  p->mem = kalloc(p->sz);
  10332e:	e8 4d f1 ff ff       	call   102480 <kalloc>
  memset(p->mem, 0, p->sz);
  103333:	8b 53 04             	mov    0x4(%ebx),%edx
  p = allocproc();
  initproc = p;

  // Initialize memory from initcode.S
  p->sz = PAGE;
  p->mem = kalloc(p->sz);
  103336:	89 03                	mov    %eax,(%ebx)
  memset(p->mem, 0, p->sz);
  103338:	89 54 24 08          	mov    %edx,0x8(%esp)
  10333c:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  103343:	00 
  103344:	89 04 24             	mov    %eax,(%esp)
  103347:	e8 34 09 00 00       	call   103c80 <memset>
  memmove(p->mem, _binary_initcode_start, (int)_binary_initcode_size);
  10334c:	c7 44 24 08 2c 00 00 	movl   $0x2c,0x8(%esp)
  103353:	00 
  103354:	c7 44 24 04 08 87 10 	movl   $0x108708,0x4(%esp)
  10335b:	00 
  10335c:	8b 03                	mov    (%ebx),%eax
  10335e:	89 04 24             	mov    %eax,(%esp)
  103361:	e8 9a 09 00 00       	call   103d00 <memmove>

  memset(p->tf, 0, sizeof(*p->tf));
  103366:	c7 44 24 08 4c 00 00 	movl   $0x4c,0x8(%esp)
  10336d:	00 
  10336e:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  103375:	00 
  103376:	8b 43 18             	mov    0x18(%ebx),%eax
  103379:	89 04 24             	mov    %eax,(%esp)
  10337c:	e8 ff 08 00 00       	call   103c80 <memset>
  p->tf->cs = (SEG_UCODE << 3) | DPL_USER;
  103381:	8b 43 18             	mov    0x18(%ebx),%eax
  103384:	66 c7 40 3c 23 00    	movw   $0x23,0x3c(%eax)
  p->tf->ds = (SEG_UDATA << 3) | DPL_USER;
  10338a:	8b 43 18             	mov    0x18(%ebx),%eax
  10338d:	66 c7 40 2c 2b 00    	movw   $0x2b,0x2c(%eax)
  p->tf->es = p->tf->ds;
  103393:	8b 43 18             	mov    0x18(%ebx),%eax
  103396:	0f b7 50 2c          	movzwl 0x2c(%eax),%edx
  10339a:	66 89 50 28          	mov    %dx,0x28(%eax)
  p->tf->ss = p->tf->ds;
  10339e:	8b 43 18             	mov    0x18(%ebx),%eax
  1033a1:	0f b7 50 2c          	movzwl 0x2c(%eax),%edx
  1033a5:	66 89 50 48          	mov    %dx,0x48(%eax)
  p->tf->eflags = FL_IF;
  1033a9:	8b 43 18             	mov    0x18(%ebx),%eax
  1033ac:	c7 40 40 00 02 00 00 	movl   $0x200,0x40(%eax)
  p->tf->esp = p->sz;
  1033b3:	8b 43 18             	mov    0x18(%ebx),%eax
  1033b6:	8b 53 04             	mov    0x4(%ebx),%edx
  1033b9:	89 50 44             	mov    %edx,0x44(%eax)
  p->tf->eip = 0;  // beginning of initcode.S
  1033bc:	8b 43 18             	mov    0x18(%ebx),%eax
  1033bf:	c7 40 38 00 00 00 00 	movl   $0x0,0x38(%eax)

  safestrcpy(p->name, "initcode", sizeof(p->name));
  1033c6:	8d 43 6c             	lea    0x6c(%ebx),%eax
  1033c9:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
  1033d0:	00 
  1033d1:	c7 44 24 04 e1 61 10 	movl   $0x1061e1,0x4(%esp)
  1033d8:	00 
  1033d9:	89 04 24             	mov    %eax,(%esp)
  1033dc:	e8 4f 0a 00 00       	call   103e30 <safestrcpy>
  p->cwd = namei("/");
  1033e1:	c7 04 24 ea 61 10 00 	movl   $0x1061ea,(%esp)
  1033e8:	e8 43 eb ff ff       	call   101f30 <namei>

  p->state = RUNNABLE;
  1033ed:	c7 43 0c 03 00 00 00 	movl   $0x3,0xc(%ebx)
  p->tf->eflags = FL_IF;
  p->tf->esp = p->sz;
  p->tf->eip = 0;  // beginning of initcode.S

  safestrcpy(p->name, "initcode", sizeof(p->name));
  p->cwd = namei("/");
  1033f4:	89 43 68             	mov    %eax,0x68(%ebx)

  p->state = RUNNABLE;
}
  1033f7:	83 c4 18             	add    $0x18,%esp
  1033fa:	5b                   	pop    %ebx
  1033fb:	c3                   	ret    
  1033fc:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

00103400 <growproc>:

// Grow current process's memory by n bytes.
// Return 0 on success, -1 on failure.
int
growproc(int n)
{
  103400:	56                   	push   %esi
  103401:	53                   	push   %ebx
  103402:	83 ec 14             	sub    $0x14,%esp
  char *newmem;

  newmem = kalloc(proc->sz + n);
  103405:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax

// Grow current process's memory by n bytes.
// Return 0 on success, -1 on failure.
int
growproc(int n)
{
  10340b:	8b 74 24 20          	mov    0x20(%esp),%esi
  char *newmem;

  newmem = kalloc(proc->sz + n);
  10340f:	8b 40 04             	mov    0x4(%eax),%eax
  103412:	01 f0                	add    %esi,%eax
  103414:	89 04 24             	mov    %eax,(%esp)
  103417:	e8 64 f0 ff ff       	call   102480 <kalloc>
  if(newmem == 0)
  10341c:	85 c0                	test   %eax,%eax
int
growproc(int n)
{
  char *newmem;

  newmem = kalloc(proc->sz + n);
  10341e:	89 c3                	mov    %eax,%ebx
  if(newmem == 0)
  103420:	74 76                	je     103498 <growproc+0x98>
    return -1;
  memmove(newmem, proc->mem, proc->sz);
  103422:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  103428:	8b 50 04             	mov    0x4(%eax),%edx
  10342b:	89 54 24 08          	mov    %edx,0x8(%esp)
  10342f:	8b 00                	mov    (%eax),%eax
  103431:	89 1c 24             	mov    %ebx,(%esp)
  103434:	89 44 24 04          	mov    %eax,0x4(%esp)
  103438:	e8 c3 08 00 00       	call   103d00 <memmove>
  memset(newmem + proc->sz, 0, n);
  10343d:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  103443:	89 74 24 08          	mov    %esi,0x8(%esp)
  103447:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  10344e:	00 
  10344f:	8b 40 04             	mov    0x4(%eax),%eax
  103452:	01 d8                	add    %ebx,%eax
  103454:	89 04 24             	mov    %eax,(%esp)
  103457:	e8 24 08 00 00       	call   103c80 <memset>
  kfree(proc->mem, proc->sz);
  10345c:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  103462:	8b 50 04             	mov    0x4(%eax),%edx
  103465:	89 54 24 04          	mov    %edx,0x4(%esp)
  103469:	8b 00                	mov    (%eax),%eax
  10346b:	89 04 24             	mov    %eax,(%esp)
  10346e:	e8 9d ee ff ff       	call   102310 <kfree>
  proc->mem = newmem;
  103473:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  103479:	89 18                	mov    %ebx,(%eax)
  proc->sz += n;
  10347b:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  103481:	01 70 04             	add    %esi,0x4(%eax)
  usegment();
  103484:	e8 87 fd ff ff       	call   103210 <usegment>
  return 0;
  103489:	31 c0                	xor    %eax,%eax
}
  10348b:	83 c4 14             	add    $0x14,%esp
  10348e:	5b                   	pop    %ebx
  10348f:	5e                   	pop    %esi
  103490:	c3                   	ret    
  103491:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
{
  char *newmem;

  newmem = kalloc(proc->sz + n);
  if(newmem == 0)
    return -1;
  103498:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
  10349d:	eb ec                	jmp    10348b <growproc+0x8b>
  10349f:	90                   	nop

001034a0 <fork>:
// Create a new process copying p as the parent.
// Sets up stack to return as if from system call.
// Caller must set state of returned proc to RUNNABLE.
int
fork(void)
{
  1034a0:	57                   	push   %edi
  1034a1:	56                   	push   %esi
  1034a2:	53                   	push   %ebx
  1034a3:	83 ec 10             	sub    $0x10,%esp
  int i, pid;
  struct proc *np;

  // Allocate process.
  if((np = allocproc()) == 0)
  1034a6:	e8 d5 fa ff ff       	call   102f80 <allocproc>
  1034ab:	85 c0                	test   %eax,%eax
  1034ad:	89 c3                	mov    %eax,%ebx
  1034af:	0f 84 ad 00 00 00    	je     103562 <fork+0xc2>
    return -1;

  // Copy process state from p.
  np->sz = proc->sz;
  1034b5:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  1034bb:	8b 40 04             	mov    0x4(%eax),%eax
  1034be:	89 43 04             	mov    %eax,0x4(%ebx)
  if((np->mem = kalloc(np->sz)) == 0){
  1034c1:	89 04 24             	mov    %eax,(%esp)
  1034c4:	e8 b7 ef ff ff       	call   102480 <kalloc>
  1034c9:	85 c0                	test   %eax,%eax
  1034cb:	89 03                	mov    %eax,(%ebx)
  1034cd:	0f 84 96 00 00 00    	je     103569 <fork+0xc9>
    kfree(np->kstack, KSTACKSIZE);
    np->kstack = 0;
    np->state = UNUSED;
    return -1;
  }
  memmove(np->mem, proc->mem, np->sz);
  1034d3:	8b 53 04             	mov    0x4(%ebx),%edx
  1034d6:	89 54 24 08          	mov    %edx,0x8(%esp)
  1034da:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
  1034e1:	8b 12                	mov    (%edx),%edx
  1034e3:	89 04 24             	mov    %eax,(%esp)
  1034e6:	89 54 24 04          	mov    %edx,0x4(%esp)
  1034ea:	e8 11 08 00 00       	call   103d00 <memmove>
  np->parent = proc;
  1034ef:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
  *np->tf = *proc->tf;
  1034f6:	b9 13 00 00 00       	mov    $0x13,%ecx
  1034fb:	8b 43 18             	mov    0x18(%ebx),%eax
    np->kstack = 0;
    np->state = UNUSED;
    return -1;
  }
  memmove(np->mem, proc->mem, np->sz);
  np->parent = proc;
  1034fe:	89 53 14             	mov    %edx,0x14(%ebx)
  *np->tf = *proc->tf;
  103501:	8b 72 18             	mov    0x18(%edx),%esi
  103504:	89 c7                	mov    %eax,%edi
  103506:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)

  // Clear %eax so that fork returns 0 in the child.
  np->tf->eax = 0;

  for(i = 0; i < NOFILE; i++)
  103508:	31 f6                	xor    %esi,%esi
  memmove(np->mem, proc->mem, np->sz);
  np->parent = proc;
  *np->tf = *proc->tf;

  // Clear %eax so that fork returns 0 in the child.
  np->tf->eax = 0;
  10350a:	8b 43 18             	mov    0x18(%ebx),%eax
  10350d:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
  103514:	c7 40 1c 00 00 00 00 	movl   $0x0,0x1c(%eax)
  10351b:	90                   	nop
  10351c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

  for(i = 0; i < NOFILE; i++)
    if(proc->ofile[i])
  103520:	8b 44 b2 28          	mov    0x28(%edx,%esi,4),%eax
  103524:	85 c0                	test   %eax,%eax
  103526:	74 13                	je     10353b <fork+0x9b>
      np->ofile[i] = filedup(proc->ofile[i]);
  103528:	89 04 24             	mov    %eax,(%esp)
  10352b:	e8 50 d9 ff ff       	call   100e80 <filedup>
  103530:	89 44 b3 28          	mov    %eax,0x28(%ebx,%esi,4)
  103534:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
  *np->tf = *proc->tf;

  // Clear %eax so that fork returns 0 in the child.
  np->tf->eax = 0;

  for(i = 0; i < NOFILE; i++)
  10353b:	83 c6 01             	add    $0x1,%esi
  10353e:	83 fe 10             	cmp    $0x10,%esi
  103541:	75 dd                	jne    103520 <fork+0x80>
    if(proc->ofile[i])
      np->ofile[i] = filedup(proc->ofile[i]);
  np->cwd = idup(proc->cwd);
  103543:	8b 42 68             	mov    0x68(%edx),%eax
  103546:	89 04 24             	mov    %eax,(%esp)
  103549:	e8 d2 e0 ff ff       	call   101620 <idup>
 
  pid = np->pid;
  np->state = RUNNABLE;
  10354e:	c7 43 0c 03 00 00 00 	movl   $0x3,0xc(%ebx)
  np->tf->eax = 0;

  for(i = 0; i < NOFILE; i++)
    if(proc->ofile[i])
      np->ofile[i] = filedup(proc->ofile[i]);
  np->cwd = idup(proc->cwd);
  103555:	89 43 68             	mov    %eax,0x68(%ebx)
 
  pid = np->pid;
  103558:	8b 43 10             	mov    0x10(%ebx),%eax
  np->state = RUNNABLE;

  return pid;
}
  10355b:	83 c4 10             	add    $0x10,%esp
  10355e:	5b                   	pop    %ebx
  10355f:	5e                   	pop    %esi
  103560:	5f                   	pop    %edi
  103561:	c3                   	ret    
  int i, pid;
  struct proc *np;

  // Allocate process.
  if((np = allocproc()) == 0)
    return -1;
  103562:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
  103567:	eb f2                	jmp    10355b <fork+0xbb>

  // Copy process state from p.
  np->sz = proc->sz;
  if((np->mem = kalloc(np->sz)) == 0){
    kfree(np->kstack, KSTACKSIZE);
  103569:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
  103570:	00 
  103571:	8b 43 08             	mov    0x8(%ebx),%eax
  103574:	89 04 24             	mov    %eax,(%esp)
  103577:	e8 94 ed ff ff       	call   102310 <kfree>
    np->kstack = 0;
    np->state = UNUSED;
    return -1;
  10357c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax

  // Copy process state from p.
  np->sz = proc->sz;
  if((np->mem = kalloc(np->sz)) == 0){
    kfree(np->kstack, KSTACKSIZE);
    np->kstack = 0;
  103581:	c7 43 08 00 00 00 00 	movl   $0x0,0x8(%ebx)
    np->state = UNUSED;
  103588:	c7 43 0c 00 00 00 00 	movl   $0x0,0xc(%ebx)
    return -1;
  10358f:	eb ca                	jmp    10355b <fork+0xbb>
  103591:	eb 0d                	jmp    1035a0 <scheduler>
  103593:	90                   	nop
  103594:	90                   	nop
  103595:	90                   	nop
  103596:	90                   	nop
  103597:	90                   	nop
  103598:	90                   	nop
  103599:	90                   	nop
  10359a:	90                   	nop
  10359b:	90                   	nop
  10359c:	90                   	nop
  10359d:	90                   	nop
  10359e:	90                   	nop
  10359f:	90                   	nop

001035a0 <scheduler>:
//  - swtch to start running that process
//  - eventually that process transfers control
//      via swtch back to the scheduler.
void
scheduler(void)
{
  1035a0:	53                   	push   %ebx
  1035a1:	83 ec 18             	sub    $0x18,%esp
  1035a4:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
}

static inline void
sti(void)
{
  asm volatile("sti");
  1035a8:	fb                   	sti    
    // Enable interrupts on this processor.
    sti();

    // Loop over process table looking for process to run.
    acquire(&ptable.lock);
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
  1035a9:	bb b4 c0 10 00       	mov    $0x10c0b4,%ebx
  for(;;){
    // Enable interrupts on this processor.
    sti();

    // Loop over process table looking for process to run.
    acquire(&ptable.lock);
  1035ae:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
  1035b5:	e8 b6 05 00 00       	call   103b70 <acquire>
  1035ba:	eb 0f                	jmp    1035cb <scheduler+0x2b>
  1035bc:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
  1035c0:	83 c3 7c             	add    $0x7c,%ebx
  1035c3:	81 fb b4 df 10 00    	cmp    $0x10dfb4,%ebx
  1035c9:	73 4d                	jae    103618 <scheduler+0x78>
      if(p->state != RUNNABLE)
  1035cb:	83 7b 0c 03          	cmpl   $0x3,0xc(%ebx)
  1035cf:	75 ef                	jne    1035c0 <scheduler+0x20>
        continue;

      // Switch to chosen process.  It is the process's job
      // to release ptable.lock and then reacquire it
      // before jumping back to us.
      proc = p;
  1035d1:	65 89 1d 04 00 00 00 	mov    %ebx,%gs:0x4
      usegment();
  1035d8:	e8 33 fc ff ff       	call   103210 <usegment>
      p->state = RUNNING;
      swtch(&cpu->scheduler, proc->context);
  1035dd:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
      // Switch to chosen process.  It is the process's job
      // to release ptable.lock and then reacquire it
      // before jumping back to us.
      proc = p;
      usegment();
      p->state = RUNNING;
  1035e3:	c7 43 0c 04 00 00 00 	movl   $0x4,0xc(%ebx)
    // Enable interrupts on this processor.
    sti();

    // Loop over process table looking for process to run.
    acquire(&ptable.lock);
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
  1035ea:	83 c3 7c             	add    $0x7c,%ebx
      // to release ptable.lock and then reacquire it
      // before jumping back to us.
      proc = p;
      usegment();
      p->state = RUNNING;
      swtch(&cpu->scheduler, proc->context);
  1035ed:	8b 40 1c             	mov    0x1c(%eax),%eax
  1035f0:	89 44 24 04          	mov    %eax,0x4(%esp)
  1035f4:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
  1035fa:	83 c0 04             	add    $0x4,%eax
  1035fd:	89 04 24             	mov    %eax,(%esp)
  103600:	e8 87 08 00 00       	call   103e8c <swtch>
    // Enable interrupts on this processor.
    sti();

    // Loop over process table looking for process to run.
    acquire(&ptable.lock);
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
  103605:	81 fb b4 df 10 00    	cmp    $0x10dfb4,%ebx
      p->state = RUNNING;
      swtch(&cpu->scheduler, proc->context);

      // Process is done running for now.
      // It should have changed its p->state before coming back.
      proc = 0;
  10360b:	65 c7 05 04 00 00 00 	movl   $0x0,%gs:0x4
  103612:	00 00 00 00 
    // Enable interrupts on this processor.
    sti();

    // Loop over process table looking for process to run.
    acquire(&ptable.lock);
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
  103616:	72 b3                	jb     1035cb <scheduler+0x2b>

      // Process is done running for now.
      // It should have changed its p->state before coming back.
      proc = 0;
    }
    release(&ptable.lock);
  103618:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
  10361f:	e8 0c 06 00 00       	call   103c30 <release>

  }
  103624:	eb 82                	jmp    1035a8 <scheduler+0x8>
  103626:	8d 76 00             	lea    0x0(%esi),%esi
  103629:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00103630 <sched>:

// Enter scheduler.  Must hold only ptable.lock
// and have changed proc->state.
void
sched(void)
{
  103630:	53                   	push   %ebx
  103631:	83 ec 18             	sub    $0x18,%esp
  int intena;

  if(!holding(&ptable.lock))
  103634:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
  10363b:	e8 e0 04 00 00       	call   103b20 <holding>
  103640:	85 c0                	test   %eax,%eax
  103642:	74 4c                	je     103690 <sched+0x60>
    panic("sched ptable.lock");
  if(cpu->ncli != 1)
  103644:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
  10364a:	83 b8 ac 00 00 00 01 	cmpl   $0x1,0xac(%eax)
  103651:	75 61                	jne    1036b4 <sched+0x84>
    panic("sched locks");
  if(proc->state == RUNNING)
  103653:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
  10365a:	83 7a 0c 04          	cmpl   $0x4,0xc(%edx)
  10365e:	74 48                	je     1036a8 <sched+0x78>

static inline uint
readeflags(void)
{
  uint eflags;
  asm volatile("pushfl; popl %0" : "=r" (eflags));
  103660:	9c                   	pushf  
  103661:	59                   	pop    %ecx
    panic("sched running");
  if(readeflags()&FL_IF)
  103662:	80 e5 02             	and    $0x2,%ch
  103665:	75 35                	jne    10369c <sched+0x6c>
    panic("sched interruptible");

  intena = cpu->intena;
  103667:	8b 98 b0 00 00 00    	mov    0xb0(%eax),%ebx
  swtch(&proc->context, cpu->scheduler);
  10366d:	83 c2 1c             	add    $0x1c,%edx
  103670:	8b 40 04             	mov    0x4(%eax),%eax
  103673:	89 14 24             	mov    %edx,(%esp)
  103676:	89 44 24 04          	mov    %eax,0x4(%esp)
  10367a:	e8 0d 08 00 00       	call   103e8c <swtch>
  cpu->intena = intena;
  10367f:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
  103685:	89 98 b0 00 00 00    	mov    %ebx,0xb0(%eax)
}
  10368b:	83 c4 18             	add    $0x18,%esp
  10368e:	5b                   	pop    %ebx
  10368f:	c3                   	ret    
sched(void)
{
  int intena;

  if(!holding(&ptable.lock))
    panic("sched ptable.lock");
  103690:	c7 04 24 ec 61 10 00 	movl   $0x1061ec,(%esp)
  103697:	e8 04 d1 ff ff       	call   1007a0 <panic>
  if(cpu->ncli != 1)
    panic("sched locks");
  if(proc->state == RUNNING)
    panic("sched running");
  if(readeflags()&FL_IF)
    panic("sched interruptible");
  10369c:	c7 04 24 18 62 10 00 	movl   $0x106218,(%esp)
  1036a3:	e8 f8 d0 ff ff       	call   1007a0 <panic>
  if(!holding(&ptable.lock))
    panic("sched ptable.lock");
  if(cpu->ncli != 1)
    panic("sched locks");
  if(proc->state == RUNNING)
    panic("sched running");
  1036a8:	c7 04 24 0a 62 10 00 	movl   $0x10620a,(%esp)
  1036af:	e8 ec d0 ff ff       	call   1007a0 <panic>
  int intena;

  if(!holding(&ptable.lock))
    panic("sched ptable.lock");
  if(cpu->ncli != 1)
    panic("sched locks");
  1036b4:	c7 04 24 fe 61 10 00 	movl   $0x1061fe,(%esp)
  1036bb:	e8 e0 d0 ff ff       	call   1007a0 <panic>

001036c0 <yield>:
}

// Give up the CPU for one scheduling round.
void
yield(void)
{
  1036c0:	83 ec 1c             	sub    $0x1c,%esp
  acquire(&ptable.lock);  //DOC: yieldlock
  1036c3:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
  1036ca:	e8 a1 04 00 00       	call   103b70 <acquire>
  proc->state = RUNNABLE;
  1036cf:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  1036d5:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
  sched();
  1036dc:	e8 4f ff ff ff       	call   103630 <sched>
  release(&ptable.lock);
  1036e1:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
  1036e8:	e8 43 05 00 00       	call   103c30 <release>
}
  1036ed:	83 c4 1c             	add    $0x1c,%esp
  1036f0:	c3                   	ret    
  1036f1:	eb 0d                	jmp    103700 <sleep>
  1036f3:	90                   	nop
  1036f4:	90                   	nop
  1036f5:	90                   	nop
  1036f6:	90                   	nop
  1036f7:	90                   	nop
  1036f8:	90                   	nop
  1036f9:	90                   	nop
  1036fa:	90                   	nop
  1036fb:	90                   	nop
  1036fc:	90                   	nop
  1036fd:	90                   	nop
  1036fe:	90                   	nop
  1036ff:	90                   	nop

00103700 <sleep>:

// Atomically release lock and sleep on chan.
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
  103700:	56                   	push   %esi
  103701:	53                   	push   %ebx
  103702:	83 ec 14             	sub    $0x14,%esp
  if(proc == 0)
  103705:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax

// Atomically release lock and sleep on chan.
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
  10370b:	8b 74 24 20          	mov    0x20(%esp),%esi
  10370f:	8b 5c 24 24          	mov    0x24(%esp),%ebx
  if(proc == 0)
  103713:	85 c0                	test   %eax,%eax
  103715:	0f 84 8b 00 00 00    	je     1037a6 <sleep+0xa6>
    panic("sleep");

  if(lk == 0)
  10371b:	85 db                	test   %ebx,%ebx
  10371d:	74 7b                	je     10379a <sleep+0x9a>
  // change p->state and then call sched.
  // Once we hold ptable.lock, we can be
  // guaranteed that we won't miss any wakeup
  // (wakeup runs with ptable.lock locked),
  // so it's okay to release lk.
  if(lk != &ptable.lock){  //DOC: sleeplock0
  10371f:	81 fb 80 c0 10 00    	cmp    $0x10c080,%ebx
  103725:	74 51                	je     103778 <sleep+0x78>
    acquire(&ptable.lock);  //DOC: sleeplock1
  103727:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
  10372e:	e8 3d 04 00 00       	call   103b70 <acquire>
    release(lk);
  103733:	89 1c 24             	mov    %ebx,(%esp)
  103736:	e8 f5 04 00 00       	call   103c30 <release>
  }

  // Go to sleep.
  proc->chan = chan;
  10373b:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  103741:	89 70 20             	mov    %esi,0x20(%eax)
  proc->state = SLEEPING;
  103744:	c7 40 0c 02 00 00 00 	movl   $0x2,0xc(%eax)
  sched();
  10374b:	e8 e0 fe ff ff       	call   103630 <sched>

  // Tidy up.
  proc->chan = 0;
  103750:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  103756:	c7 40 20 00 00 00 00 	movl   $0x0,0x20(%eax)

  // Reacquire original lock.
  if(lk != &ptable.lock){  //DOC: sleeplock2
    release(&ptable.lock);
  10375d:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
  103764:	e8 c7 04 00 00       	call   103c30 <release>
    acquire(lk);
  103769:	89 5c 24 20          	mov    %ebx,0x20(%esp)
  }
}
  10376d:	83 c4 14             	add    $0x14,%esp
  103770:	5b                   	pop    %ebx
  103771:	5e                   	pop    %esi
  proc->chan = 0;

  // Reacquire original lock.
  if(lk != &ptable.lock){  //DOC: sleeplock2
    release(&ptable.lock);
    acquire(lk);
  103772:	e9 f9 03 00 00       	jmp    103b70 <acquire>
  103777:	90                   	nop
    acquire(&ptable.lock);  //DOC: sleeplock1
    release(lk);
  }

  // Go to sleep.
  proc->chan = chan;
  103778:	89 70 20             	mov    %esi,0x20(%eax)
  proc->state = SLEEPING;
  10377b:	c7 40 0c 02 00 00 00 	movl   $0x2,0xc(%eax)
  sched();
  103782:	e8 a9 fe ff ff       	call   103630 <sched>

  // Tidy up.
  proc->chan = 0;
  103787:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  10378d:	c7 40 20 00 00 00 00 	movl   $0x0,0x20(%eax)
  // Reacquire original lock.
  if(lk != &ptable.lock){  //DOC: sleeplock2
    release(&ptable.lock);
    acquire(lk);
  }
}
  103794:	83 c4 14             	add    $0x14,%esp
  103797:	5b                   	pop    %ebx
  103798:	5e                   	pop    %esi
  103799:	c3                   	ret    
{
  if(proc == 0)
    panic("sleep");

  if(lk == 0)
    panic("sleep without lk");
  10379a:	c7 04 24 32 62 10 00 	movl   $0x106232,(%esp)
  1037a1:	e8 fa cf ff ff       	call   1007a0 <panic>
// Reacquires lock when awakened.
void
sleep(void *chan, struct spinlock *lk)
{
  if(proc == 0)
    panic("sleep");
  1037a6:	c7 04 24 2c 62 10 00 	movl   $0x10622c,(%esp)
  1037ad:	e8 ee cf ff ff       	call   1007a0 <panic>
  1037b2:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  1037b9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

001037c0 <wakeup>:
}

// Wake up all processes sleeping on chan.
void
wakeup(void *chan)
{
  1037c0:	53                   	push   %ebx
  1037c1:	83 ec 18             	sub    $0x18,%esp
  1037c4:	8b 5c 24 20          	mov    0x20(%esp),%ebx
  acquire(&ptable.lock);
  1037c8:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
  1037cf:	e8 9c 03 00 00       	call   103b70 <acquire>
static void
wakeup1(void *chan)
{
  struct proc *p;

  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
  1037d4:	b8 b4 c0 10 00       	mov    $0x10c0b4,%eax
  1037d9:	eb 0f                	jmp    1037ea <wakeup+0x2a>
  1037db:	90                   	nop
  1037dc:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  1037e0:	83 c0 7c             	add    $0x7c,%eax
  1037e3:	3d b4 df 10 00       	cmp    $0x10dfb4,%eax
  1037e8:	73 1e                	jae    103808 <wakeup+0x48>
    if(p->state == SLEEPING && p->chan == chan)
  1037ea:	83 78 0c 02          	cmpl   $0x2,0xc(%eax)
  1037ee:	75 f0                	jne    1037e0 <wakeup+0x20>
  1037f0:	3b 58 20             	cmp    0x20(%eax),%ebx
  1037f3:	75 eb                	jne    1037e0 <wakeup+0x20>
      p->state = RUNNABLE;
  1037f5:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
static void
wakeup1(void *chan)
{
  struct proc *p;

  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
  1037fc:	83 c0 7c             	add    $0x7c,%eax
  1037ff:	3d b4 df 10 00       	cmp    $0x10dfb4,%eax
  103804:	72 e4                	jb     1037ea <wakeup+0x2a>
  103806:	66 90                	xchg   %ax,%ax
void
wakeup(void *chan)
{
  acquire(&ptable.lock);
  wakeup1(chan);
  release(&ptable.lock);
  103808:	c7 44 24 20 80 c0 10 	movl   $0x10c080,0x20(%esp)
  10380f:	00 
}
  103810:	83 c4 18             	add    $0x18,%esp
  103813:	5b                   	pop    %ebx
void
wakeup(void *chan)
{
  acquire(&ptable.lock);
  wakeup1(chan);
  release(&ptable.lock);
  103814:	e9 17 04 00 00       	jmp    103c30 <release>
  103819:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi

00103820 <kill>:
// Kill the process with the given pid.
// Process won't exit until it returns
// to user space (see trap in trap.c).
int
kill(int pid)
{
  103820:	53                   	push   %ebx
  103821:	83 ec 18             	sub    $0x18,%esp
  103824:	8b 5c 24 20          	mov    0x20(%esp),%ebx
  struct proc *p;

  acquire(&ptable.lock);
  103828:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
  10382f:	e8 3c 03 00 00       	call   103b70 <acquire>
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
    if(p->pid == pid){
  103834:	a1 c4 c0 10 00       	mov    0x10c0c4,%eax
  103839:	ba b4 c0 10 00       	mov    $0x10c0b4,%edx
  10383e:	39 d8                	cmp    %ebx,%eax
  103840:	75 08                	jne    10384a <kill+0x2a>
  103842:	eb 62                	jmp    1038a6 <kill+0x86>
  103844:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  103848:	89 c2                	mov    %eax,%edx
kill(int pid)
{
  struct proc *p;

  acquire(&ptable.lock);
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
  10384a:	8d 42 7c             	lea    0x7c(%edx),%eax
  10384d:	3d b4 df 10 00       	cmp    $0x10dfb4,%eax
  103852:	73 3c                	jae    103890 <kill+0x70>
    if(p->pid == pid){
  103854:	8b 92 8c 00 00 00    	mov    0x8c(%edx),%edx
  10385a:	39 da                	cmp    %ebx,%edx
  10385c:	75 ea                	jne    103848 <kill+0x28>
      p->killed = 1;
      // Wake process from sleep if necessary.
      if(p->state == SLEEPING)
  10385e:	83 78 0c 02          	cmpl   $0x2,0xc(%eax)
  struct proc *p;

  acquire(&ptable.lock);
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
    if(p->pid == pid){
      p->killed = 1;
  103862:	c7 40 24 01 00 00 00 	movl   $0x1,0x24(%eax)
      // Wake process from sleep if necessary.
      if(p->state == SLEEPING)
  103869:	74 15                	je     103880 <kill+0x60>
        p->state = RUNNABLE;
      release(&ptable.lock);
  10386b:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
  103872:	e8 b9 03 00 00       	call   103c30 <release>
      return 0;
    }
  }
  release(&ptable.lock);
  return -1;
}
  103877:	83 c4 18             	add    $0x18,%esp
      p->killed = 1;
      // Wake process from sleep if necessary.
      if(p->state == SLEEPING)
        p->state = RUNNABLE;
      release(&ptable.lock);
      return 0;
  10387a:	31 c0                	xor    %eax,%eax
    }
  }
  release(&ptable.lock);
  return -1;
}
  10387c:	5b                   	pop    %ebx
  10387d:	c3                   	ret    
  10387e:	66 90                	xchg   %ax,%ax
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
    if(p->pid == pid){
      p->killed = 1;
      // Wake process from sleep if necessary.
      if(p->state == SLEEPING)
        p->state = RUNNABLE;
  103880:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
  103887:	eb e2                	jmp    10386b <kill+0x4b>
  103889:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
      release(&ptable.lock);
      return 0;
    }
  }
  release(&ptable.lock);
  103890:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
  103897:	e8 94 03 00 00       	call   103c30 <release>
  return -1;
}
  10389c:	83 c4 18             	add    $0x18,%esp
      release(&ptable.lock);
      return 0;
    }
  }
  release(&ptable.lock);
  return -1;
  10389f:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
  1038a4:	5b                   	pop    %ebx
  1038a5:	c3                   	ret    
kill(int pid)
{
  struct proc *p;

  acquire(&ptable.lock);
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
  1038a6:	b8 b4 c0 10 00       	mov    $0x10c0b4,%eax
  1038ab:	eb b1                	jmp    10385e <kill+0x3e>
  1038ad:	8d 76 00             	lea    0x0(%esi),%esi

001038b0 <exit>:
// Exit the current process.  Does not return.
// An exited process remains in the zombie state
// until its parent calls wait() to find out it exited.
void
exit(void)
{
  1038b0:	56                   	push   %esi
  1038b1:	53                   	push   %ebx
  struct proc *p;
  int fd;

  if(proc == initproc)
  1038b2:	31 db                	xor    %ebx,%ebx
// Exit the current process.  Does not return.
// An exited process remains in the zombie state
// until its parent calls wait() to find out it exited.
void
exit(void)
{
  1038b4:	83 ec 14             	sub    $0x14,%esp
  struct proc *p;
  int fd;

  if(proc == initproc)
  1038b7:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
  1038be:	3b 15 28 88 10 00    	cmp    0x108828,%edx
  1038c4:	0f 84 f4 00 00 00    	je     1039be <exit+0x10e>
  1038ca:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    panic("init exiting");

  // Close all open files.
  for(fd = 0; fd < NOFILE; fd++){
    if(proc->ofile[fd]){
  1038d0:	8d 73 08             	lea    0x8(%ebx),%esi
  1038d3:	8b 44 b2 08          	mov    0x8(%edx,%esi,4),%eax
  1038d7:	85 c0                	test   %eax,%eax
  1038d9:	74 17                	je     1038f2 <exit+0x42>
      fileclose(proc->ofile[fd]);
  1038db:	89 04 24             	mov    %eax,(%esp)
  1038de:	e8 dd d5 ff ff       	call   100ec0 <fileclose>
      proc->ofile[fd] = 0;
  1038e3:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
  1038ea:	c7 44 b2 08 00 00 00 	movl   $0x0,0x8(%edx,%esi,4)
  1038f1:	00 

  if(proc == initproc)
    panic("init exiting");

  // Close all open files.
  for(fd = 0; fd < NOFILE; fd++){
  1038f2:	83 c3 01             	add    $0x1,%ebx
  1038f5:	83 fb 10             	cmp    $0x10,%ebx
  1038f8:	75 d6                	jne    1038d0 <exit+0x20>
      fileclose(proc->ofile[fd]);
      proc->ofile[fd] = 0;
    }
  }

  iput(proc->cwd);
  1038fa:	8b 42 68             	mov    0x68(%edx),%eax
  1038fd:	89 04 24             	mov    %eax,(%esp)
  103900:	e8 9b de ff ff       	call   1017a0 <iput>
  proc->cwd = 0;
  103905:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  10390b:	c7 40 68 00 00 00 00 	movl   $0x0,0x68(%eax)

  acquire(&ptable.lock);
  103912:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
  103919:	e8 52 02 00 00       	call   103b70 <acquire>

  // Parent might be sleeping in wait().
  wakeup1(proc->parent);
  10391e:	65 8b 0d 04 00 00 00 	mov    %gs:0x4,%ecx
static void
wakeup1(void *chan)
{
  struct proc *p;

  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
  103925:	b8 b4 c0 10 00       	mov    $0x10c0b4,%eax
  proc->cwd = 0;

  acquire(&ptable.lock);

  // Parent might be sleeping in wait().
  wakeup1(proc->parent);
  10392a:	8b 51 14             	mov    0x14(%ecx),%edx
  10392d:	eb 0b                	jmp    10393a <exit+0x8a>
  10392f:	90                   	nop
static void
wakeup1(void *chan)
{
  struct proc *p;

  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
  103930:	83 c0 7c             	add    $0x7c,%eax
  103933:	3d b4 df 10 00       	cmp    $0x10dfb4,%eax
  103938:	73 1c                	jae    103956 <exit+0xa6>
    if(p->state == SLEEPING && p->chan == chan)
  10393a:	83 78 0c 02          	cmpl   $0x2,0xc(%eax)
  10393e:	75 f0                	jne    103930 <exit+0x80>
  103940:	3b 50 20             	cmp    0x20(%eax),%edx
  103943:	75 eb                	jne    103930 <exit+0x80>
      p->state = RUNNABLE;
  103945:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
static void
wakeup1(void *chan)
{
  struct proc *p;

  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
  10394c:	83 c0 7c             	add    $0x7c,%eax
  10394f:	3d b4 df 10 00       	cmp    $0x10dfb4,%eax
  103954:	72 e4                	jb     10393a <exit+0x8a>
  wakeup1(proc->parent);

  // Pass abandoned children to init.
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
    if(p->parent == proc){
      p->parent = initproc;
  103956:	8b 1d 28 88 10 00    	mov    0x108828,%ebx
  10395c:	ba b4 c0 10 00       	mov    $0x10c0b4,%edx
  103961:	eb 10                	jmp    103973 <exit+0xc3>
  103963:	90                   	nop
  103964:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

  // Parent might be sleeping in wait().
  wakeup1(proc->parent);

  // Pass abandoned children to init.
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
  103968:	83 c2 7c             	add    $0x7c,%edx
  10396b:	81 fa b4 df 10 00    	cmp    $0x10dfb4,%edx
  103971:	73 33                	jae    1039a6 <exit+0xf6>
    if(p->parent == proc){
  103973:	3b 4a 14             	cmp    0x14(%edx),%ecx
  103976:	75 f0                	jne    103968 <exit+0xb8>
      p->parent = initproc;
      if(p->state == ZOMBIE)
  103978:	83 7a 0c 05          	cmpl   $0x5,0xc(%edx)
  wakeup1(proc->parent);

  // Pass abandoned children to init.
  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
    if(p->parent == proc){
      p->parent = initproc;
  10397c:	89 5a 14             	mov    %ebx,0x14(%edx)
      if(p->state == ZOMBIE)
  10397f:	75 e7                	jne    103968 <exit+0xb8>
  103981:	b8 b4 c0 10 00       	mov    $0x10c0b4,%eax
  103986:	eb 0a                	jmp    103992 <exit+0xe2>
static void
wakeup1(void *chan)
{
  struct proc *p;

  for(p = ptable.proc; p < &ptable.proc[NPROC]; p++)
  103988:	83 c0 7c             	add    $0x7c,%eax
  10398b:	3d b4 df 10 00       	cmp    $0x10dfb4,%eax
  103990:	73 d6                	jae    103968 <exit+0xb8>
    if(p->state == SLEEPING && p->chan == chan)
  103992:	83 78 0c 02          	cmpl   $0x2,0xc(%eax)
  103996:	75 f0                	jne    103988 <exit+0xd8>
  103998:	3b 58 20             	cmp    0x20(%eax),%ebx
  10399b:	75 eb                	jne    103988 <exit+0xd8>
      p->state = RUNNABLE;
  10399d:	c7 40 0c 03 00 00 00 	movl   $0x3,0xc(%eax)
  1039a4:	eb e2                	jmp    103988 <exit+0xd8>
        wakeup1(initproc);
    }
  }

  // Jump into the scheduler, never to return.
  proc->state = ZOMBIE;
  1039a6:	c7 41 0c 05 00 00 00 	movl   $0x5,0xc(%ecx)
  sched();
  1039ad:	e8 7e fc ff ff       	call   103630 <sched>
  panic("zombie exit");
  1039b2:	c7 04 24 50 62 10 00 	movl   $0x106250,(%esp)
  1039b9:	e8 e2 cd ff ff       	call   1007a0 <panic>
{
  struct proc *p;
  int fd;

  if(proc == initproc)
    panic("init exiting");
  1039be:	c7 04 24 43 62 10 00 	movl   $0x106243,(%esp)
  1039c5:	e8 d6 cd ff ff       	call   1007a0 <panic>
  1039ca:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi

001039d0 <wait>:

// Wait for a child process to exit and return its pid.
// Return -1 if this process has no children.
int
wait(void)
{
  1039d0:	56                   	push   %esi
  1039d1:	53                   	push   %ebx
  1039d2:	83 ec 14             	sub    $0x14,%esp
  struct proc *p;
  int havekids, pid;

  acquire(&ptable.lock);
  1039d5:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
  1039dc:	e8 8f 01 00 00       	call   103b70 <acquire>
  1039e1:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  for(;;){
    // Scan through table looking for zombie children.
    havekids = 0;
  1039e7:	31 d2                	xor    %edx,%edx
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
  1039e9:	bb b4 c0 10 00       	mov    $0x10c0b4,%ebx
  1039ee:	eb 0b                	jmp    1039fb <wait+0x2b>
  1039f0:	83 c3 7c             	add    $0x7c,%ebx
  1039f3:	81 fb b4 df 10 00    	cmp    $0x10dfb4,%ebx
  1039f9:	73 1d                	jae    103a18 <wait+0x48>
      if(p->parent != proc)
  1039fb:	39 43 14             	cmp    %eax,0x14(%ebx)
  1039fe:	75 f0                	jne    1039f0 <wait+0x20>
        continue;
      havekids = 1;
      if(p->state == ZOMBIE){
  103a00:	83 7b 0c 05          	cmpl   $0x5,0xc(%ebx)
  103a04:	74 2f                	je     103a35 <wait+0x65>

  acquire(&ptable.lock);
  for(;;){
    // Scan through table looking for zombie children.
    havekids = 0;
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
  103a06:	83 c3 7c             	add    $0x7c,%ebx
      if(p->parent != proc)
        continue;
      havekids = 1;
  103a09:	ba 01 00 00 00       	mov    $0x1,%edx

  acquire(&ptable.lock);
  for(;;){
    // Scan through table looking for zombie children.
    havekids = 0;
    for(p = ptable.proc; p < &ptable.proc[NPROC]; p++){
  103a0e:	81 fb b4 df 10 00    	cmp    $0x10dfb4,%ebx
  103a14:	72 e5                	jb     1039fb <wait+0x2b>
  103a16:	66 90                	xchg   %ax,%ax
        return pid;
      }
    }

    // No point waiting if we don't have any children.
    if(!havekids || proc->killed){
  103a18:	85 d2                	test   %edx,%edx
  103a1a:	74 74                	je     103a90 <wait+0xc0>
  103a1c:	8b 48 24             	mov    0x24(%eax),%ecx
  103a1f:	85 c9                	test   %ecx,%ecx
  103a21:	75 6d                	jne    103a90 <wait+0xc0>
      release(&ptable.lock);
      return -1;
    }

    // Wait for children to exit.  (See wakeup1 call in proc_exit.)
    sleep(proc, &ptable.lock);  //DOC: wait-sleep
  103a23:	c7 44 24 04 80 c0 10 	movl   $0x10c080,0x4(%esp)
  103a2a:	00 
  103a2b:	89 04 24             	mov    %eax,(%esp)
  103a2e:	e8 cd fc ff ff       	call   103700 <sleep>
  }
  103a33:	eb ac                	jmp    1039e1 <wait+0x11>
        continue;
      havekids = 1;
      if(p->state == ZOMBIE){
        // Found one.
        pid = p->pid;
        kfree(p->mem, p->sz);
  103a35:	8b 43 04             	mov    0x4(%ebx),%eax
      if(p->parent != proc)
        continue;
      havekids = 1;
      if(p->state == ZOMBIE){
        // Found one.
        pid = p->pid;
  103a38:	8b 73 10             	mov    0x10(%ebx),%esi
        kfree(p->mem, p->sz);
  103a3b:	89 44 24 04          	mov    %eax,0x4(%esp)
  103a3f:	8b 03                	mov    (%ebx),%eax
  103a41:	89 04 24             	mov    %eax,(%esp)
  103a44:	e8 c7 e8 ff ff       	call   102310 <kfree>
        kfree(p->kstack, KSTACKSIZE);
  103a49:	8b 43 08             	mov    0x8(%ebx),%eax
  103a4c:	c7 44 24 04 00 10 00 	movl   $0x1000,0x4(%esp)
  103a53:	00 
  103a54:	89 04 24             	mov    %eax,(%esp)
  103a57:	e8 b4 e8 ff ff       	call   102310 <kfree>
        p->state = UNUSED;
  103a5c:	c7 43 0c 00 00 00 00 	movl   $0x0,0xc(%ebx)
        p->pid = 0;
  103a63:	c7 43 10 00 00 00 00 	movl   $0x0,0x10(%ebx)
        p->parent = 0;
  103a6a:	c7 43 14 00 00 00 00 	movl   $0x0,0x14(%ebx)
        p->name[0] = 0;
  103a71:	c6 43 6c 00          	movb   $0x0,0x6c(%ebx)
        p->killed = 0;
  103a75:	c7 43 24 00 00 00 00 	movl   $0x0,0x24(%ebx)
        release(&ptable.lock);
  103a7c:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
  103a83:	e8 a8 01 00 00       	call   103c30 <release>
    }

    // Wait for children to exit.  (See wakeup1 call in proc_exit.)
    sleep(proc, &ptable.lock);  //DOC: wait-sleep
  }
}
  103a88:	83 c4 14             	add    $0x14,%esp
  103a8b:	89 f0                	mov    %esi,%eax
  103a8d:	5b                   	pop    %ebx
  103a8e:	5e                   	pop    %esi
  103a8f:	c3                   	ret    
      }
    }

    // No point waiting if we don't have any children.
    if(!havekids || proc->killed){
      release(&ptable.lock);
  103a90:	c7 04 24 80 c0 10 00 	movl   $0x10c080,(%esp)
      return -1;
  103a97:	be ff ff ff ff       	mov    $0xffffffff,%esi
      }
    }

    // No point waiting if we don't have any children.
    if(!havekids || proc->killed){
      release(&ptable.lock);
  103a9c:	e8 8f 01 00 00       	call   103c30 <release>
    }

    // Wait for children to exit.  (See wakeup1 call in proc_exit.)
    sleep(proc, &ptable.lock);  //DOC: wait-sleep
  }
}
  103aa1:	83 c4 14             	add    $0x14,%esp
  103aa4:	89 f0                	mov    %esi,%eax
  103aa6:	5b                   	pop    %ebx
  103aa7:	5e                   	pop    %esi
  103aa8:	c3                   	ret    
  103aa9:	90                   	nop
  103aaa:	90                   	nop
  103aab:	90                   	nop
  103aac:	90                   	nop
  103aad:	90                   	nop
  103aae:	90                   	nop
  103aaf:	90                   	nop

00103ab0 <initlock>:
#include "proc.h"
#include "spinlock.h"

void
initlock(struct spinlock *lk, char *name)
{
  103ab0:	8b 44 24 04          	mov    0x4(%esp),%eax
  lk->name = name;
  103ab4:	8b 54 24 08          	mov    0x8(%esp),%edx
  lk->locked = 0;
  103ab8:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
#include "spinlock.h"

void
initlock(struct spinlock *lk, char *name)
{
  lk->name = name;
  103abe:	89 50 04             	mov    %edx,0x4(%eax)
  lk->locked = 0;
  lk->cpu = 0;
  103ac1:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
}
  103ac8:	c3                   	ret    
  103ac9:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi

00103ad0 <getcallerpcs>:
}

// Record the current call stack in pcs[] by following the %ebp chain.
void
getcallerpcs(void *v, uint pcs[])
{
  103ad0:	53                   	push   %ebx
  uint *ebp;
  int i;
  
  ebp = (uint*)v - 2;
  103ad1:	8b 54 24 08          	mov    0x8(%esp),%edx
  for(i = 0; i < 10; i++){
  103ad5:	31 c0                	xor    %eax,%eax
}

// Record the current call stack in pcs[] by following the %ebp chain.
void
getcallerpcs(void *v, uint pcs[])
{
  103ad7:	8b 4c 24 0c          	mov    0xc(%esp),%ecx
  uint *ebp;
  int i;
  
  ebp = (uint*)v - 2;
  103adb:	83 ea 08             	sub    $0x8,%edx
  103ade:	66 90                	xchg   %ax,%ax
  for(i = 0; i < 10; i++){
    if(ebp == 0 || ebp == (uint*)0xffffffff)
  103ae0:	8d 5a ff             	lea    -0x1(%edx),%ebx
  103ae3:	83 fb fd             	cmp    $0xfffffffd,%ebx
  103ae6:	77 18                	ja     103b00 <getcallerpcs+0x30>
      break;
    pcs[i] = ebp[1];     // saved %eip
  103ae8:	8b 5a 04             	mov    0x4(%edx),%ebx
  103aeb:	89 1c 81             	mov    %ebx,(%ecx,%eax,4)
{
  uint *ebp;
  int i;
  
  ebp = (uint*)v - 2;
  for(i = 0; i < 10; i++){
  103aee:	83 c0 01             	add    $0x1,%eax
    if(ebp == 0 || ebp == (uint*)0xffffffff)
      break;
    pcs[i] = ebp[1];     // saved %eip
    ebp = (uint*)ebp[0]; // saved %ebp
  103af1:	8b 12                	mov    (%edx),%edx
{
  uint *ebp;
  int i;
  
  ebp = (uint*)v - 2;
  for(i = 0; i < 10; i++){
  103af3:	83 f8 0a             	cmp    $0xa,%eax
  103af6:	75 e8                	jne    103ae0 <getcallerpcs+0x10>
    pcs[i] = ebp[1];     // saved %eip
    ebp = (uint*)ebp[0]; // saved %ebp
  }
  for(; i < 10; i++)
    pcs[i] = 0;
}
  103af8:	5b                   	pop    %ebx
  103af9:	c3                   	ret    
  103afa:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
      break;
    pcs[i] = ebp[1];     // saved %eip
    ebp = (uint*)ebp[0]; // saved %ebp
  }
  for(; i < 10; i++)
    pcs[i] = 0;
  103b00:	c7 04 81 00 00 00 00 	movl   $0x0,(%ecx,%eax,4)
    if(ebp == 0 || ebp == (uint*)0xffffffff)
      break;
    pcs[i] = ebp[1];     // saved %eip
    ebp = (uint*)ebp[0]; // saved %ebp
  }
  for(; i < 10; i++)
  103b07:	83 c0 01             	add    $0x1,%eax
  103b0a:	83 f8 0a             	cmp    $0xa,%eax
  103b0d:	74 e9                	je     103af8 <getcallerpcs+0x28>
    pcs[i] = 0;
  103b0f:	c7 04 81 00 00 00 00 	movl   $0x0,(%ecx,%eax,4)
    if(ebp == 0 || ebp == (uint*)0xffffffff)
      break;
    pcs[i] = ebp[1];     // saved %eip
    ebp = (uint*)ebp[0]; // saved %ebp
  }
  for(; i < 10; i++)
  103b16:	83 c0 01             	add    $0x1,%eax
  103b19:	83 f8 0a             	cmp    $0xa,%eax
  103b1c:	75 e2                	jne    103b00 <getcallerpcs+0x30>
  103b1e:	eb d8                	jmp    103af8 <getcallerpcs+0x28>

00103b20 <holding>:
}

// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
  103b20:	8b 54 24 04          	mov    0x4(%esp),%edx
  return lock->locked && lock->cpu == cpu;
  103b24:	31 c0                	xor    %eax,%eax
  103b26:	8b 0a                	mov    (%edx),%ecx
  103b28:	85 c9                	test   %ecx,%ecx
  103b2a:	74 0f                	je     103b3b <holding+0x1b>
    pcs[i] = 0;
}

// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
  103b2c:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
  103b32:	39 42 08             	cmp    %eax,0x8(%edx)
{
  return lock->locked && lock->cpu == cpu;
  103b35:	0f 94 c0             	sete   %al
  103b38:	0f b6 c0             	movzbl %al,%eax
}
  103b3b:	f3 c3                	repz ret 
  103b3d:	8d 76 00             	lea    0x0(%esi),%esi

00103b40 <pushcli>:
// it takes two popcli to undo two pushcli.  Also, if interrupts
// are off, then pushcli, popcli leaves them off.

void
pushcli(void)
{
  103b40:	53                   	push   %ebx
  103b41:	9c                   	pushf  
  103b42:	5b                   	pop    %ebx
}

static inline void
cli(void)
{
  asm volatile("cli");
  103b43:	fa                   	cli    
  int eflags;
  
  eflags = readeflags();
  cli();
  if(cpu->ncli++ == 0)
  103b44:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
  103b4a:	8b 90 ac 00 00 00    	mov    0xac(%eax),%edx
  103b50:	8d 4a 01             	lea    0x1(%edx),%ecx
  103b53:	85 d2                	test   %edx,%edx
  103b55:	89 88 ac 00 00 00    	mov    %ecx,0xac(%eax)
  103b5b:	75 0c                	jne    103b69 <pushcli+0x29>
    cpu->intena = eflags & FL_IF;
  103b5d:	81 e3 00 02 00 00    	and    $0x200,%ebx
  103b63:	89 98 b0 00 00 00    	mov    %ebx,0xb0(%eax)
}
  103b69:	5b                   	pop    %ebx
  103b6a:	c3                   	ret    
  103b6b:	90                   	nop
  103b6c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

00103b70 <acquire>:
// Loops (spins) until the lock is acquired.
// Holding a lock for a long time may cause
// other CPUs to waste time spinning to acquire it.
void
acquire(struct spinlock *lk)
{
  103b70:	83 ec 1c             	sub    $0x1c,%esp
  pushcli();
  103b73:	e8 c8 ff ff ff       	call   103b40 <pushcli>
  if(holding(lk))
  103b78:	8b 54 24 20          	mov    0x20(%esp),%edx

// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
  return lock->locked && lock->cpu == cpu;
  103b7c:	8b 02                	mov    (%edx),%eax
  103b7e:	85 c0                	test   %eax,%eax
  103b80:	74 0b                	je     103b8d <acquire+0x1d>
  103b82:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
  103b88:	39 42 08             	cmp    %eax,0x8(%edx)
  103b8b:	74 43                	je     103bd0 <acquire+0x60>
xchg(volatile uint *addr, uint newval)
{
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
  103b8d:	b9 01 00 00 00       	mov    $0x1,%ecx
  103b92:	eb 08                	jmp    103b9c <acquire+0x2c>
  103b94:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    panic("acquire");

  // The xchg is atomic.
  // It also serializes, so that reads after acquire are not
  // reordered before it. 
  while(xchg(&lk->locked, 1) != 0)
  103b98:	8b 54 24 20          	mov    0x20(%esp),%edx
  103b9c:	89 c8                	mov    %ecx,%eax
  103b9e:	f0 87 02             	lock xchg %eax,(%edx)
  103ba1:	85 c0                	test   %eax,%eax
  103ba3:	75 f3                	jne    103b98 <acquire+0x28>
    ;

  // Record info about lock acquisition for debugging.
  lk->cpu = cpu;
  103ba5:	8b 44 24 20          	mov    0x20(%esp),%eax
  103ba9:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
  103bb0:	89 50 08             	mov    %edx,0x8(%eax)
  getcallerpcs(&lk, lk->pcs);
  103bb3:	83 c0 0c             	add    $0xc,%eax
  103bb6:	89 44 24 04          	mov    %eax,0x4(%esp)
  103bba:	8d 44 24 20          	lea    0x20(%esp),%eax
  103bbe:	89 04 24             	mov    %eax,(%esp)
  103bc1:	e8 0a ff ff ff       	call   103ad0 <getcallerpcs>
}
  103bc6:	83 c4 1c             	add    $0x1c,%esp
  103bc9:	c3                   	ret    
  103bca:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
void
acquire(struct spinlock *lk)
{
  pushcli();
  if(holding(lk))
    panic("acquire");
  103bd0:	c7 04 24 a0 62 10 00 	movl   $0x1062a0,(%esp)
  103bd7:	e8 c4 cb ff ff       	call   1007a0 <panic>
  103bdc:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

00103be0 <popcli>:
    cpu->intena = eflags & FL_IF;
}

void
popcli(void)
{
  103be0:	83 ec 1c             	sub    $0x1c,%esp

static inline uint
readeflags(void)
{
  uint eflags;
  asm volatile("pushfl; popl %0" : "=r" (eflags));
  103be3:	9c                   	pushf  
  103be4:	58                   	pop    %eax
  if(readeflags()&FL_IF)
  103be5:	f6 c4 02             	test   $0x2,%ah
  103be8:	75 37                	jne    103c21 <popcli+0x41>
    panic("popcli - interruptible");
  if(--cpu->ncli < 0)
  103bea:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
  103bf0:	8b 90 ac 00 00 00    	mov    0xac(%eax),%edx
  103bf6:	83 ea 01             	sub    $0x1,%edx
  103bf9:	83 fa 00             	cmp    $0x0,%edx
  103bfc:	89 90 ac 00 00 00    	mov    %edx,0xac(%eax)
  103c02:	7c 11                	jl     103c15 <popcli+0x35>
    panic("popcli");
  if(cpu->ncli == 0 && cpu->intena)
  103c04:	75 0b                	jne    103c11 <popcli+0x31>
  103c06:	8b 80 b0 00 00 00    	mov    0xb0(%eax),%eax
  103c0c:	85 c0                	test   %eax,%eax
  103c0e:	74 01                	je     103c11 <popcli+0x31>
}

static inline void
sti(void)
{
  asm volatile("sti");
  103c10:	fb                   	sti    
    sti();
}
  103c11:	83 c4 1c             	add    $0x1c,%esp
  103c14:	c3                   	ret    
popcli(void)
{
  if(readeflags()&FL_IF)
    panic("popcli - interruptible");
  if(--cpu->ncli < 0)
    panic("popcli");
  103c15:	c7 04 24 bf 62 10 00 	movl   $0x1062bf,(%esp)
  103c1c:	e8 7f cb ff ff       	call   1007a0 <panic>

void
popcli(void)
{
  if(readeflags()&FL_IF)
    panic("popcli - interruptible");
  103c21:	c7 04 24 a8 62 10 00 	movl   $0x1062a8,(%esp)
  103c28:	e8 73 cb ff ff       	call   1007a0 <panic>
  103c2d:	8d 76 00             	lea    0x0(%esi),%esi

00103c30 <release>:
}

// Release the lock.
void
release(struct spinlock *lk)
{
  103c30:	83 ec 1c             	sub    $0x1c,%esp
  103c33:	8b 54 24 20          	mov    0x20(%esp),%edx

// Check whether this cpu is holding the lock.
int
holding(struct spinlock *lock)
{
  return lock->locked && lock->cpu == cpu;
  103c37:	8b 02                	mov    (%edx),%eax
  103c39:	85 c0                	test   %eax,%eax
  103c3b:	74 0b                	je     103c48 <release+0x18>
  103c3d:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
  103c43:	39 42 08             	cmp    %eax,0x8(%edx)
  103c46:	74 10                	je     103c58 <release+0x28>
// Release the lock.
void
release(struct spinlock *lk)
{
  if(!holding(lk))
    panic("release");
  103c48:	c7 04 24 c6 62 10 00 	movl   $0x1062c6,(%esp)
  103c4f:	e8 4c cb ff ff       	call   1007a0 <panic>
  103c54:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

  lk->pcs[0] = 0;
  103c58:	c7 42 0c 00 00 00 00 	movl   $0x0,0xc(%edx)
xchg(volatile uint *addr, uint newval)
{
  uint result;
  
  // The + in "+m" denotes a read-modify-write operand.
  asm volatile("lock; xchgl %0, %1" :
  103c5f:	31 c0                	xor    %eax,%eax
  lk->cpu = 0;
  103c61:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
  103c68:	f0 87 02             	lock xchg %eax,(%edx)
  // The xchg being asm volatile ensures gcc emits it after
  // the above assignments (and after the critical section).
  xchg(&lk->locked, 0);

  popcli();
}
  103c6b:	83 c4 1c             	add    $0x1c,%esp
  // after a store. So lock->locked = 0 would work here.
  // The xchg being asm volatile ensures gcc emits it after
  // the above assignments (and after the critical section).
  xchg(&lk->locked, 0);

  popcli();
  103c6e:	e9 6d ff ff ff       	jmp    103be0 <popcli>
  103c73:	90                   	nop
  103c74:	90                   	nop
  103c75:	90                   	nop
  103c76:	90                   	nop
  103c77:	90                   	nop
  103c78:	90                   	nop
  103c79:	90                   	nop
  103c7a:	90                   	nop
  103c7b:	90                   	nop
  103c7c:	90                   	nop
  103c7d:	90                   	nop
  103c7e:	90                   	nop
  103c7f:	90                   	nop

00103c80 <memset>:
#include "types.h"
#include "x86.h"

void*
memset(void *dst, int c, uint n)
{
  103c80:	57                   	push   %edi
  103c81:	8b 54 24 08          	mov    0x8(%esp),%edx
}

static inline void
stosb(void *addr, int data, int cnt)
{
  asm volatile("cld; rep stosb" :
  103c85:	8b 4c 24 10          	mov    0x10(%esp),%ecx
  103c89:	8b 44 24 0c          	mov    0xc(%esp),%eax
  103c8d:	89 d7                	mov    %edx,%edi
  103c8f:	fc                   	cld    
  103c90:	f3 aa                	rep stos %al,%es:(%edi)
  stosb(dst, c, n);
  return dst;
}
  103c92:	89 d0                	mov    %edx,%eax
  103c94:	5f                   	pop    %edi
  103c95:	c3                   	ret    
  103c96:	8d 76 00             	lea    0x0(%esi),%esi
  103c99:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00103ca0 <memcmp>:

int
memcmp(const void *v1, const void *v2, uint n)
{
  103ca0:	57                   	push   %edi
    if(*s1 != *s2)
      return *s1 - *s2;
    s1++, s2++;
  }

  return 0;
  103ca1:	31 c0                	xor    %eax,%eax
  return dst;
}

int
memcmp(const void *v1, const void *v2, uint n)
{
  103ca3:	56                   	push   %esi
  103ca4:	53                   	push   %ebx
  103ca5:	8b 7c 24 18          	mov    0x18(%esp),%edi
  103ca9:	8b 5c 24 10          	mov    0x10(%esp),%ebx
  103cad:	8b 74 24 14          	mov    0x14(%esp),%esi
  const uchar *s1, *s2;
  
  s1 = v1;
  s2 = v2;
  while(n-- > 0){
  103cb1:	85 ff                	test   %edi,%edi
  103cb3:	74 29                	je     103cde <memcmp+0x3e>
    if(*s1 != *s2)
  103cb5:	0f b6 03             	movzbl (%ebx),%eax
{
  const uchar *s1, *s2;
  
  s1 = v1;
  s2 = v2;
  while(n-- > 0){
  103cb8:	83 ef 01             	sub    $0x1,%edi
  103cbb:	31 d2                	xor    %edx,%edx
    if(*s1 != *s2)
  103cbd:	0f b6 0e             	movzbl (%esi),%ecx
  103cc0:	38 c8                	cmp    %cl,%al
  103cc2:	74 14                	je     103cd8 <memcmp+0x38>
  103cc4:	eb 22                	jmp    103ce8 <memcmp+0x48>
  103cc6:	66 90                	xchg   %ax,%ax
  103cc8:	0f b6 44 13 01       	movzbl 0x1(%ebx,%edx,1),%eax
  103ccd:	83 c2 01             	add    $0x1,%edx
  103cd0:	0f b6 0c 16          	movzbl (%esi,%edx,1),%ecx
  103cd4:	38 c8                	cmp    %cl,%al
  103cd6:	75 10                	jne    103ce8 <memcmp+0x48>
{
  const uchar *s1, *s2;
  
  s1 = v1;
  s2 = v2;
  while(n-- > 0){
  103cd8:	39 d7                	cmp    %edx,%edi
  103cda:	75 ec                	jne    103cc8 <memcmp+0x28>
    if(*s1 != *s2)
      return *s1 - *s2;
    s1++, s2++;
  }

  return 0;
  103cdc:	31 c0                	xor    %eax,%eax
}
  103cde:	5b                   	pop    %ebx
  103cdf:	5e                   	pop    %esi
  103ce0:	5f                   	pop    %edi
  103ce1:	c3                   	ret    
  103ce2:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  
  s1 = v1;
  s2 = v2;
  while(n-- > 0){
    if(*s1 != *s2)
      return *s1 - *s2;
  103ce8:	0f b6 c0             	movzbl %al,%eax
  103ceb:	0f b6 c9             	movzbl %cl,%ecx
    s1++, s2++;
  }

  return 0;
}
  103cee:	5b                   	pop    %ebx
  
  s1 = v1;
  s2 = v2;
  while(n-- > 0){
    if(*s1 != *s2)
      return *s1 - *s2;
  103cef:	29 c8                	sub    %ecx,%eax
    s1++, s2++;
  }

  return 0;
}
  103cf1:	5e                   	pop    %esi
  103cf2:	5f                   	pop    %edi
  103cf3:	c3                   	ret    
  103cf4:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  103cfa:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00103d00 <memmove>:

void*
memmove(void *dst, const void *src, uint n)
{
  103d00:	57                   	push   %edi
  103d01:	56                   	push   %esi
  103d02:	53                   	push   %ebx
  103d03:	8b 44 24 10          	mov    0x10(%esp),%eax
  103d07:	8b 74 24 14          	mov    0x14(%esp),%esi
  103d0b:	8b 5c 24 18          	mov    0x18(%esp),%ebx
  const char *s;
  char *d;

  s = src;
  d = dst;
  if(s < d && s + n > d){
  103d0f:	39 c6                	cmp    %eax,%esi
  103d11:	73 35                	jae    103d48 <memmove+0x48>
  103d13:	8d 0c 1e             	lea    (%esi,%ebx,1),%ecx
  103d16:	39 c8                	cmp    %ecx,%eax
  103d18:	73 2e                	jae    103d48 <memmove+0x48>
    s += n;
    d += n;
    while(n-- > 0)
  103d1a:	85 db                	test   %ebx,%ebx
  103d1c:	74 20                	je     103d3e <memmove+0x3e>

  s = src;
  d = dst;
  if(s < d && s + n > d){
    s += n;
    d += n;
  103d1e:	8d 3c 18             	lea    (%eax,%ebx,1),%edi
  103d21:	89 da                	mov    %ebx,%edx

  return 0;
}

void*
memmove(void *dst, const void *src, uint n)
  103d23:	f7 db                	neg    %ebx
  103d25:	8d 34 19             	lea    (%ecx,%ebx,1),%esi
  103d28:	01 fb                	add    %edi,%ebx
  103d2a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  d = dst;
  if(s < d && s + n > d){
    s += n;
    d += n;
    while(n-- > 0)
      *--d = *--s;
  103d30:	0f b6 4c 16 ff       	movzbl -0x1(%esi,%edx,1),%ecx
  103d35:	88 4c 13 ff          	mov    %cl,-0x1(%ebx,%edx,1)
  s = src;
  d = dst;
  if(s < d && s + n > d){
    s += n;
    d += n;
    while(n-- > 0)
  103d39:	83 ea 01             	sub    $0x1,%edx
  103d3c:	75 f2                	jne    103d30 <memmove+0x30>
  } else
    while(n-- > 0)
      *d++ = *s++;

  return dst;
}
  103d3e:	5b                   	pop    %ebx
  103d3f:	5e                   	pop    %esi
  103d40:	5f                   	pop    %edi
  103d41:	c3                   	ret    
  103d42:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    s += n;
    d += n;
    while(n-- > 0)
      *--d = *--s;
  } else
    while(n-- > 0)
  103d48:	31 d2                	xor    %edx,%edx
  103d4a:	85 db                	test   %ebx,%ebx
  103d4c:	74 f0                	je     103d3e <memmove+0x3e>
  103d4e:	66 90                	xchg   %ax,%ax
      *d++ = *s++;
  103d50:	0f b6 0c 16          	movzbl (%esi,%edx,1),%ecx
  103d54:	88 0c 10             	mov    %cl,(%eax,%edx,1)
  103d57:	83 c2 01             	add    $0x1,%edx
    s += n;
    d += n;
    while(n-- > 0)
      *--d = *--s;
  } else
    while(n-- > 0)
  103d5a:	39 d3                	cmp    %edx,%ebx
  103d5c:	75 f2                	jne    103d50 <memmove+0x50>
      *d++ = *s++;

  return dst;
}
  103d5e:	5b                   	pop    %ebx
  103d5f:	5e                   	pop    %esi
  103d60:	5f                   	pop    %edi
  103d61:	c3                   	ret    
  103d62:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  103d69:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00103d70 <memcpy>:

void *
memcpy(void *dst, const void *src, uint n)
{
  return memmove(dst, src, n);
  103d70:	e9 8b ff ff ff       	jmp    103d00 <memmove>
  103d75:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  103d79:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00103d80 <strncmp>:
}

int
strncmp(const char *p, const char *q, uint n)
{
  103d80:	55                   	push   %ebp
  while(n > 0 && *p && *p == *q)
    n--, p++, q++;
  if(n == 0)
    return 0;
  103d81:	31 c0                	xor    %eax,%eax
  return memmove(dst, src, n);
}

int
strncmp(const char *p, const char *q, uint n)
{
  103d83:	57                   	push   %edi
  103d84:	56                   	push   %esi
  103d85:	53                   	push   %ebx
  103d86:	8b 6c 24 1c          	mov    0x1c(%esp),%ebp
  103d8a:	8b 4c 24 14          	mov    0x14(%esp),%ecx
  103d8e:	8b 5c 24 18          	mov    0x18(%esp),%ebx
  while(n > 0 && *p && *p == *q)
  103d92:	85 ed                	test   %ebp,%ebp
  103d94:	74 32                	je     103dc8 <strncmp+0x48>
  103d96:	0f b6 01             	movzbl (%ecx),%eax
  103d99:	0f b6 33             	movzbl (%ebx),%esi
  103d9c:	84 c0                	test   %al,%al
  103d9e:	74 30                	je     103dd0 <strncmp+0x50>
  103da0:	89 f2                	mov    %esi,%edx
  103da2:	38 d0                	cmp    %dl,%al
  103da4:	74 1b                	je     103dc1 <strncmp+0x41>
  103da6:	eb 28                	jmp    103dd0 <strncmp+0x50>
    n--, p++, q++;
  103da8:	83 c1 01             	add    $0x1,%ecx
}

int
strncmp(const char *p, const char *q, uint n)
{
  while(n > 0 && *p && *p == *q)
  103dab:	0f b6 73 01          	movzbl 0x1(%ebx),%esi
  103daf:	0f b6 01             	movzbl (%ecx),%eax
    n--, p++, q++;
  103db2:	8d 7b 01             	lea    0x1(%ebx),%edi
}

int
strncmp(const char *p, const char *q, uint n)
{
  while(n > 0 && *p && *p == *q)
  103db5:	84 c0                	test   %al,%al
  103db7:	74 17                	je     103dd0 <strncmp+0x50>
  103db9:	89 f2                	mov    %esi,%edx
  103dbb:	38 d0                	cmp    %dl,%al
  103dbd:	75 11                	jne    103dd0 <strncmp+0x50>
    n--, p++, q++;
  103dbf:	89 fb                	mov    %edi,%ebx
}

int
strncmp(const char *p, const char *q, uint n)
{
  while(n > 0 && *p && *p == *q)
  103dc1:	83 ed 01             	sub    $0x1,%ebp
  103dc4:	75 e2                	jne    103da8 <strncmp+0x28>
    n--, p++, q++;
  if(n == 0)
    return 0;
  103dc6:	31 c0                	xor    %eax,%eax
  return (uchar)*p - (uchar)*q;
}
  103dc8:	5b                   	pop    %ebx
  103dc9:	5e                   	pop    %esi
  103dca:	5f                   	pop    %edi
  103dcb:	5d                   	pop    %ebp
  103dcc:	c3                   	ret    
  103dcd:	8d 76 00             	lea    0x0(%esi),%esi
{
  while(n > 0 && *p && *p == *q)
    n--, p++, q++;
  if(n == 0)
    return 0;
  return (uchar)*p - (uchar)*q;
  103dd0:	81 e6 ff 00 00 00    	and    $0xff,%esi
  103dd6:	0f b6 c0             	movzbl %al,%eax
}
  103dd9:	5b                   	pop    %ebx
{
  while(n > 0 && *p && *p == *q)
    n--, p++, q++;
  if(n == 0)
    return 0;
  return (uchar)*p - (uchar)*q;
  103dda:	29 f0                	sub    %esi,%eax
}
  103ddc:	5e                   	pop    %esi
  103ddd:	5f                   	pop    %edi
  103dde:	5d                   	pop    %ebp
  103ddf:	c3                   	ret    

00103de0 <strncpy>:

char*
strncpy(char *s, const char *t, int n)
{
  103de0:	57                   	push   %edi
  103de1:	56                   	push   %esi
  103de2:	53                   	push   %ebx
  103de3:	8b 7c 24 10          	mov    0x10(%esp),%edi
  103de7:	8b 5c 24 14          	mov    0x14(%esp),%ebx
  103deb:	8b 4c 24 18          	mov    0x18(%esp),%ecx
  char *os;
  
  os = s;
  while(n-- > 0 && (*s++ = *t++) != 0)
  103def:	89 fa                	mov    %edi,%edx
  103df1:	eb 14                	jmp    103e07 <strncpy+0x27>
  103df3:	90                   	nop
  103df4:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  103df8:	0f b6 03             	movzbl (%ebx),%eax
  103dfb:	83 c3 01             	add    $0x1,%ebx
  103dfe:	88 02                	mov    %al,(%edx)
  103e00:	83 c2 01             	add    $0x1,%edx
  103e03:	84 c0                	test   %al,%al
  103e05:	74 0a                	je     103e11 <strncpy+0x31>
  103e07:	83 e9 01             	sub    $0x1,%ecx
    return 0;
  return (uchar)*p - (uchar)*q;
}

char*
strncpy(char *s, const char *t, int n)
  103e0a:	8d 71 01             	lea    0x1(%ecx),%esi
{
  char *os;
  
  os = s;
  while(n-- > 0 && (*s++ = *t++) != 0)
  103e0d:	85 f6                	test   %esi,%esi
  103e0f:	7f e7                	jg     103df8 <strncpy+0x18>
    ;
  while(n-- > 0)
  103e11:	85 c9                	test   %ecx,%ecx
    return 0;
  return (uchar)*p - (uchar)*q;
}

char*
strncpy(char *s, const char *t, int n)
  103e13:	8d 1c 0a             	lea    (%edx,%ecx,1),%ebx
  char *os;
  
  os = s;
  while(n-- > 0 && (*s++ = *t++) != 0)
    ;
  while(n-- > 0)
  103e16:	7e 0a                	jle    103e22 <strncpy+0x42>
    *s++ = 0;
  103e18:	c6 02 00             	movb   $0x0,(%edx)
  103e1b:	83 c2 01             	add    $0x1,%edx
  char *os;
  
  os = s;
  while(n-- > 0 && (*s++ = *t++) != 0)
    ;
  while(n-- > 0)
  103e1e:	39 da                	cmp    %ebx,%edx
  103e20:	75 f6                	jne    103e18 <strncpy+0x38>
    *s++ = 0;
  return os;
}
  103e22:	89 f8                	mov    %edi,%eax
  103e24:	5b                   	pop    %ebx
  103e25:	5e                   	pop    %esi
  103e26:	5f                   	pop    %edi
  103e27:	c3                   	ret    
  103e28:	90                   	nop
  103e29:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi

00103e30 <safestrcpy>:

// Like strncpy but guaranteed to NUL-terminate.
char*
safestrcpy(char *s, const char *t, int n)
{
  103e30:	56                   	push   %esi
  103e31:	53                   	push   %ebx
  103e32:	8b 54 24 14          	mov    0x14(%esp),%edx
  103e36:	8b 74 24 0c          	mov    0xc(%esp),%esi
  103e3a:	8b 5c 24 10          	mov    0x10(%esp),%ebx
  char *os;
  
  os = s;
  if(n <= 0)
  103e3e:	85 d2                	test   %edx,%edx
  103e40:	7e 1d                	jle    103e5f <safestrcpy+0x2f>
  103e42:	89 f1                	mov    %esi,%ecx
  103e44:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    return os;
  while(--n > 0 && (*s++ = *t++) != 0)
  103e48:	83 ea 01             	sub    $0x1,%edx
  103e4b:	74 0f                	je     103e5c <safestrcpy+0x2c>
  103e4d:	0f b6 03             	movzbl (%ebx),%eax
  103e50:	83 c3 01             	add    $0x1,%ebx
  103e53:	88 01                	mov    %al,(%ecx)
  103e55:	83 c1 01             	add    $0x1,%ecx
  103e58:	84 c0                	test   %al,%al
  103e5a:	75 ec                	jne    103e48 <safestrcpy+0x18>
    ;
  *s = 0;
  103e5c:	c6 01 00             	movb   $0x0,(%ecx)
  return os;
}
  103e5f:	89 f0                	mov    %esi,%eax
  103e61:	5b                   	pop    %ebx
  103e62:	5e                   	pop    %esi
  103e63:	c3                   	ret    
  103e64:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  103e6a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00103e70 <strlen>:

int
strlen(const char *s)
{
  103e70:	8b 54 24 04          	mov    0x4(%esp),%edx
  int n;

  for(n = 0; s[n]; n++)
  103e74:	31 c0                	xor    %eax,%eax
  103e76:	80 3a 00             	cmpb   $0x0,(%edx)
  103e79:	74 0e                	je     103e89 <strlen+0x19>
  103e7b:	90                   	nop
  103e7c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  103e80:	83 c0 01             	add    $0x1,%eax
  103e83:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  103e87:	75 f7                	jne    103e80 <strlen+0x10>
    ;
  return n;
}
  103e89:	f3 c3                	repz ret 
  103e8b:	90                   	nop

00103e8c <swtch>:
  103e8c:	8b 44 24 04          	mov    0x4(%esp),%eax
  103e90:	8b 54 24 08          	mov    0x8(%esp),%edx
  103e94:	55                   	push   %ebp
  103e95:	53                   	push   %ebx
  103e96:	56                   	push   %esi
  103e97:	57                   	push   %edi
  103e98:	89 20                	mov    %esp,(%eax)
  103e9a:	89 d4                	mov    %edx,%esp
  103e9c:	5f                   	pop    %edi
  103e9d:	5e                   	pop    %esi
  103e9e:	5b                   	pop    %ebx
  103e9f:	5d                   	pop    %ebp
  103ea0:	c3                   	ret    
  103ea1:	90                   	nop
  103ea2:	90                   	nop
  103ea3:	90                   	nop
  103ea4:	90                   	nop
  103ea5:	90                   	nop
  103ea6:	90                   	nop
  103ea7:	90                   	nop
  103ea8:	90                   	nop
  103ea9:	90                   	nop
  103eaa:	90                   	nop
  103eab:	90                   	nop
  103eac:	90                   	nop
  103ead:	90                   	nop
  103eae:	90                   	nop
  103eaf:	90                   	nop

00103eb0 <fetchint>:
// to a saved program counter, and then the first argument.

// Fetch the int at addr from process p.
int
fetchint(struct proc *p, uint addr, int *ip)
{
  103eb0:	83 ec 08             	sub    $0x8,%esp
  if(addr >= p->sz || addr+4 > p->sz)
    return -1;
  103eb3:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
// to a saved program counter, and then the first argument.

// Fetch the int at addr from process p.
int
fetchint(struct proc *p, uint addr, int *ip)
{
  103eb8:	89 1c 24             	mov    %ebx,(%esp)
  103ebb:	8b 5c 24 0c          	mov    0xc(%esp),%ebx
  103ebf:	89 74 24 04          	mov    %esi,0x4(%esp)
  103ec3:	8b 54 24 10          	mov    0x10(%esp),%edx
  if(addr >= p->sz || addr+4 > p->sz)
  103ec7:	8b 4b 04             	mov    0x4(%ebx),%ecx
  103eca:	39 d1                	cmp    %edx,%ecx
  103ecc:	76 14                	jbe    103ee2 <fetchint+0x32>
  103ece:	8d 72 04             	lea    0x4(%edx),%esi
  103ed1:	39 f1                	cmp    %esi,%ecx
  103ed3:	72 0d                	jb     103ee2 <fetchint+0x32>
    return -1;
  *ip = *(int*)(p->mem + addr);
  103ed5:	8b 03                	mov    (%ebx),%eax
  103ed7:	8b 14 10             	mov    (%eax,%edx,1),%edx
  103eda:	8b 44 24 14          	mov    0x14(%esp),%eax
  103ede:	89 10                	mov    %edx,(%eax)
  return 0;
  103ee0:	31 c0                	xor    %eax,%eax
}
  103ee2:	8b 1c 24             	mov    (%esp),%ebx
  103ee5:	8b 74 24 04          	mov    0x4(%esp),%esi
  103ee9:	83 c4 08             	add    $0x8,%esp
  103eec:	c3                   	ret    
  103eed:	8d 76 00             	lea    0x0(%esi),%esi

00103ef0 <fetchstr>:
// Fetch the nul-terminated string at addr from process p.
// Doesn't actually copy the string - just sets *pp to point at it.
// Returns length of string, not including nul.
int
fetchstr(struct proc *p, uint addr, char **pp)
{
  103ef0:	53                   	push   %ebx
  103ef1:	8b 5c 24 08          	mov    0x8(%esp),%ebx
  char *s, *ep;

  if(addr >= p->sz)
    return -1;
  103ef5:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
// Fetch the nul-terminated string at addr from process p.
// Doesn't actually copy the string - just sets *pp to point at it.
// Returns length of string, not including nul.
int
fetchstr(struct proc *p, uint addr, char **pp)
{
  103efa:	8b 4c 24 0c          	mov    0xc(%esp),%ecx
  char *s, *ep;

  if(addr >= p->sz)
  103efe:	39 4b 04             	cmp    %ecx,0x4(%ebx)
  103f01:	76 2e                	jbe    103f31 <fetchstr+0x41>
    return -1;
  *pp = p->mem + addr;
  103f03:	8b 54 24 10          	mov    0x10(%esp),%edx
  103f07:	03 0b                	add    (%ebx),%ecx
  103f09:	89 0a                	mov    %ecx,(%edx)
  ep = p->mem + p->sz;
  103f0b:	8b 13                	mov    (%ebx),%edx
  103f0d:	03 53 04             	add    0x4(%ebx),%edx
  for(s = *pp; s < ep; s++)
  103f10:	39 d1                	cmp    %edx,%ecx
  103f12:	73 1d                	jae    103f31 <fetchstr+0x41>
    if(*s == 0)
  103f14:	31 c0                	xor    %eax,%eax
  103f16:	80 39 00             	cmpb   $0x0,(%ecx)
  103f19:	74 16                	je     103f31 <fetchstr+0x41>
  103f1b:	89 c8                	mov    %ecx,%eax
  103f1d:	eb 06                	jmp    103f25 <fetchstr+0x35>
  103f1f:	90                   	nop
  103f20:	80 38 00             	cmpb   $0x0,(%eax)
  103f23:	74 13                	je     103f38 <fetchstr+0x48>

  if(addr >= p->sz)
    return -1;
  *pp = p->mem + addr;
  ep = p->mem + p->sz;
  for(s = *pp; s < ep; s++)
  103f25:	83 c0 01             	add    $0x1,%eax
  103f28:	39 d0                	cmp    %edx,%eax
  103f2a:	75 f4                	jne    103f20 <fetchstr+0x30>
    if(*s == 0)
      return s - *pp;
  return -1;
  103f2c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
  103f31:	5b                   	pop    %ebx
  103f32:	c3                   	ret    
  103f33:	90                   	nop
  103f34:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  if(addr >= p->sz)
    return -1;
  *pp = p->mem + addr;
  ep = p->mem + p->sz;
  for(s = *pp; s < ep; s++)
    if(*s == 0)
  103f38:	29 c8                	sub    %ecx,%eax
      return s - *pp;
  return -1;
}
  103f3a:	5b                   	pop    %ebx
  103f3b:	c3                   	ret    
  103f3c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

00103f40 <argint>:

// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
  103f40:	83 ec 08             	sub    $0x8,%esp
  return fetchint(proc, proc->tf->esp + 4 + 4*n, ip);
  103f43:	65 8b 0d 04 00 00 00 	mov    %gs:0x4,%ecx
}

// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
  103f4a:	89 74 24 04          	mov    %esi,0x4(%esp)
  return fetchint(proc, proc->tf->esp + 4 + 4*n, ip);
  103f4e:	8b 54 24 0c          	mov    0xc(%esp),%edx
}

// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
  103f52:	89 1c 24             	mov    %ebx,(%esp)
  return fetchint(proc, proc->tf->esp + 4 + 4*n, ip);
  103f55:	8b 41 18             	mov    0x18(%ecx),%eax
  103f58:	c1 e2 02             	shl    $0x2,%edx

// Fetch the int at addr from process p.
int
fetchint(struct proc *p, uint addr, int *ip)
{
  if(addr >= p->sz || addr+4 > p->sz)
  103f5b:	8b 59 04             	mov    0x4(%ecx),%ebx

// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
  return fetchint(proc, proc->tf->esp + 4 + 4*n, ip);
  103f5e:	03 50 44             	add    0x44(%eax),%edx
// Fetch the int at addr from process p.
int
fetchint(struct proc *p, uint addr, int *ip)
{
  if(addr >= p->sz || addr+4 > p->sz)
    return -1;
  103f61:	b8 ff ff ff ff       	mov    $0xffffffff,%eax

// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
  return fetchint(proc, proc->tf->esp + 4 + 4*n, ip);
  103f66:	8d 72 04             	lea    0x4(%edx),%esi

// Fetch the int at addr from process p.
int
fetchint(struct proc *p, uint addr, int *ip)
{
  if(addr >= p->sz || addr+4 > p->sz)
  103f69:	39 de                	cmp    %ebx,%esi
  103f6b:	73 15                	jae    103f82 <argint+0x42>
  103f6d:	8d 72 08             	lea    0x8(%edx),%esi
  103f70:	39 f3                	cmp    %esi,%ebx
  103f72:	72 0e                	jb     103f82 <argint+0x42>
    return -1;
  *ip = *(int*)(p->mem + addr);
  103f74:	8b 01                	mov    (%ecx),%eax
  103f76:	8b 54 10 04          	mov    0x4(%eax,%edx,1),%edx
  103f7a:	8b 44 24 10          	mov    0x10(%esp),%eax
  103f7e:	89 10                	mov    %edx,(%eax)
  return 0;
  103f80:	31 c0                	xor    %eax,%eax
// Fetch the nth 32-bit system call argument.
int
argint(int n, int *ip)
{
  return fetchint(proc, proc->tf->esp + 4 + 4*n, ip);
}
  103f82:	8b 1c 24             	mov    (%esp),%ebx
  103f85:	8b 74 24 04          	mov    0x4(%esp),%esi
  103f89:	83 c4 08             	add    $0x8,%esp
  103f8c:	c3                   	ret    
  103f8d:	8d 76 00             	lea    0x0(%esi),%esi

00103f90 <argptr>:
// Fetch the nth word-sized system call argument as a pointer
// to a block of memory of size n bytes.  Check that the pointer
// lies within the process address space.
int
argptr(int n, char **pp, int size)
{
  103f90:	56                   	push   %esi
  103f91:	53                   	push   %ebx
  103f92:	83 ec 18             	sub    $0x18,%esp
  int i;
  
  if(argint(n, &i) < 0)
  103f95:	8d 44 24 14          	lea    0x14(%esp),%eax
  103f99:	89 44 24 04          	mov    %eax,0x4(%esp)
  103f9d:	8b 44 24 24          	mov    0x24(%esp),%eax
  103fa1:	89 04 24             	mov    %eax,(%esp)
  103fa4:	e8 97 ff ff ff       	call   103f40 <argint>
  103fa9:	85 c0                	test   %eax,%eax
  103fab:	78 33                	js     103fe0 <argptr+0x50>
    return -1;
  if((uint)i >= proc->sz || (uint)i+size >= proc->sz)
  103fad:	65 8b 1d 04 00 00 00 	mov    %gs:0x4,%ebx
    return -1;
  103fb4:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
{
  int i;
  
  if(argint(n, &i) < 0)
    return -1;
  if((uint)i >= proc->sz || (uint)i+size >= proc->sz)
  103fb9:	8b 54 24 14          	mov    0x14(%esp),%edx
  103fbd:	8b 4b 04             	mov    0x4(%ebx),%ecx
  103fc0:	39 ca                	cmp    %ecx,%edx
  103fc2:	73 14                	jae    103fd8 <argptr+0x48>
  103fc4:	8b 74 24 2c          	mov    0x2c(%esp),%esi
  103fc8:	01 d6                	add    %edx,%esi
  103fca:	39 f1                	cmp    %esi,%ecx
  103fcc:	76 0a                	jbe    103fd8 <argptr+0x48>
    return -1;
  *pp = proc->mem + i;
  103fce:	8b 44 24 28          	mov    0x28(%esp),%eax
  103fd2:	03 13                	add    (%ebx),%edx
  103fd4:	89 10                	mov    %edx,(%eax)
  return 0;
  103fd6:	31 c0                	xor    %eax,%eax
}
  103fd8:	83 c4 18             	add    $0x18,%esp
  103fdb:	5b                   	pop    %ebx
  103fdc:	5e                   	pop    %esi
  103fdd:	c3                   	ret    
  103fde:	66 90                	xchg   %ax,%ax
argptr(int n, char **pp, int size)
{
  int i;
  
  if(argint(n, &i) < 0)
    return -1;
  103fe0:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
  103fe5:	eb f1                	jmp    103fd8 <argptr+0x48>
  103fe7:	89 f6                	mov    %esi,%esi
  103fe9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00103ff0 <argstr>:
// Check that the pointer is valid and the string is nul-terminated.
// (There is no shared writable memory, so the string can't change
// between this check and being used by the kernel.)
int
argstr(int n, char **pp)
{
  103ff0:	53                   	push   %ebx
  103ff1:	83 ec 18             	sub    $0x18,%esp
  int addr;
  if(argint(n, &addr) < 0)
  103ff4:	8d 44 24 14          	lea    0x14(%esp),%eax
  103ff8:	89 44 24 04          	mov    %eax,0x4(%esp)
  103ffc:	8b 44 24 20          	mov    0x20(%esp),%eax
  104000:	89 04 24             	mov    %eax,(%esp)
  104003:	e8 38 ff ff ff       	call   103f40 <argint>
  104008:	85 c0                	test   %eax,%eax
  10400a:	78 40                	js     10404c <argstr+0x5c>
    return -1;
  return fetchstr(proc, addr, pp);
  10400c:	65 8b 0d 04 00 00 00 	mov    %gs:0x4,%ecx
fetchstr(struct proc *p, uint addr, char **pp)
{
  char *s, *ep;

  if(addr >= p->sz)
    return -1;
  104013:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
argstr(int n, char **pp)
{
  int addr;
  if(argint(n, &addr) < 0)
    return -1;
  return fetchstr(proc, addr, pp);
  104018:	8b 5c 24 14          	mov    0x14(%esp),%ebx
int
fetchstr(struct proc *p, uint addr, char **pp)
{
  char *s, *ep;

  if(addr >= p->sz)
  10401c:	3b 59 04             	cmp    0x4(%ecx),%ebx
  10401f:	73 30                	jae    104051 <argstr+0x61>
    return -1;
  *pp = p->mem + addr;
  104021:	8b 54 24 24          	mov    0x24(%esp),%edx
  104025:	03 19                	add    (%ecx),%ebx
  104027:	89 1a                	mov    %ebx,(%edx)
  ep = p->mem + p->sz;
  104029:	8b 11                	mov    (%ecx),%edx
  10402b:	03 51 04             	add    0x4(%ecx),%edx
  for(s = *pp; s < ep; s++)
  10402e:	39 d3                	cmp    %edx,%ebx
  104030:	73 1f                	jae    104051 <argstr+0x61>
    if(*s == 0)
  104032:	31 c0                	xor    %eax,%eax
  104034:	80 3b 00             	cmpb   $0x0,(%ebx)
  104037:	74 18                	je     104051 <argstr+0x61>
  104039:	89 d8                	mov    %ebx,%eax
  10403b:	eb 08                	jmp    104045 <argstr+0x55>
  10403d:	8d 76 00             	lea    0x0(%esi),%esi
  104040:	80 38 00             	cmpb   $0x0,(%eax)
  104043:	74 13                	je     104058 <argstr+0x68>

  if(addr >= p->sz)
    return -1;
  *pp = p->mem + addr;
  ep = p->mem + p->sz;
  for(s = *pp; s < ep; s++)
  104045:	83 c0 01             	add    $0x1,%eax
  104048:	39 d0                	cmp    %edx,%eax
  10404a:	75 f4                	jne    104040 <argstr+0x50>
int
argstr(int n, char **pp)
{
  int addr;
  if(argint(n, &addr) < 0)
    return -1;
  10404c:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
  return fetchstr(proc, addr, pp);
}
  104051:	83 c4 18             	add    $0x18,%esp
  104054:	5b                   	pop    %ebx
  104055:	c3                   	ret    
  104056:	66 90                	xchg   %ax,%ax
  104058:	83 c4 18             	add    $0x18,%esp
  if(addr >= p->sz)
    return -1;
  *pp = p->mem + addr;
  ep = p->mem + p->sz;
  for(s = *pp; s < ep; s++)
    if(*s == 0)
  10405b:	29 d8                	sub    %ebx,%eax
{
  int addr;
  if(argint(n, &addr) < 0)
    return -1;
  return fetchstr(proc, addr, pp);
}
  10405d:	5b                   	pop    %ebx
  10405e:	c3                   	ret    
  10405f:	90                   	nop

00104060 <syscall>:
[SYS_write]   sys_write,
};

void
syscall(void)
{
  104060:	53                   	push   %ebx
  104061:	83 ec 18             	sub    $0x18,%esp
  int num;
  
  num = proc->tf->eax;
  104064:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
  10406b:	8b 5a 18             	mov    0x18(%edx),%ebx
  10406e:	8b 43 1c             	mov    0x1c(%ebx),%eax
  if(num >= 0 && num < NELEM(syscalls) && syscalls[num])
  104071:	83 f8 14             	cmp    $0x14,%eax
  104074:	77 1a                	ja     104090 <syscall+0x30>
  104076:	8b 0c 85 00 63 10 00 	mov    0x106300(,%eax,4),%ecx
  10407d:	85 c9                	test   %ecx,%ecx
  10407f:	74 0f                	je     104090 <syscall+0x30>
    proc->tf->eax = syscalls[num]();
  104081:	ff d1                	call   *%ecx
  104083:	89 43 1c             	mov    %eax,0x1c(%ebx)
  else {
    cprintf("%d %s: unknown sys call %d\n",
            proc->pid, proc->name, num);
    proc->tf->eax = -1;
  }
}
  104086:	83 c4 18             	add    $0x18,%esp
  104089:	5b                   	pop    %ebx
  10408a:	c3                   	ret    
  10408b:	90                   	nop
  10408c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  
  num = proc->tf->eax;
  if(num >= 0 && num < NELEM(syscalls) && syscalls[num])
    proc->tf->eax = syscalls[num]();
  else {
    cprintf("%d %s: unknown sys call %d\n",
  104090:	8b 4a 10             	mov    0x10(%edx),%ecx
            proc->pid, proc->name, num);
  104093:	83 c2 6c             	add    $0x6c,%edx
  
  num = proc->tf->eax;
  if(num >= 0 && num < NELEM(syscalls) && syscalls[num])
    proc->tf->eax = syscalls[num]();
  else {
    cprintf("%d %s: unknown sys call %d\n",
  104096:	89 44 24 0c          	mov    %eax,0xc(%esp)
            proc->pid, proc->name, num);
  10409a:	89 54 24 08          	mov    %edx,0x8(%esp)
  
  num = proc->tf->eax;
  if(num >= 0 && num < NELEM(syscalls) && syscalls[num])
    proc->tf->eax = syscalls[num]();
  else {
    cprintf("%d %s: unknown sys call %d\n",
  10409e:	c7 04 24 ce 62 10 00 	movl   $0x1062ce,(%esp)
  1040a5:	89 4c 24 04          	mov    %ecx,0x4(%esp)
  1040a9:	e8 a2 c5 ff ff       	call   100650 <cprintf>
            proc->pid, proc->name, num);
    proc->tf->eax = -1;
  1040ae:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  1040b4:	8b 40 18             	mov    0x18(%eax),%eax
  1040b7:	c7 40 1c ff ff ff ff 	movl   $0xffffffff,0x1c(%eax)
  }
}
  1040be:	83 c4 18             	add    $0x18,%esp
  1040c1:	5b                   	pop    %ebx
  1040c2:	c3                   	ret    
  1040c3:	90                   	nop
  1040c4:	90                   	nop
  1040c5:	90                   	nop
  1040c6:	90                   	nop
  1040c7:	90                   	nop
  1040c8:	90                   	nop
  1040c9:	90                   	nop
  1040ca:	90                   	nop
  1040cb:	90                   	nop
  1040cc:	90                   	nop
  1040cd:	90                   	nop
  1040ce:	90                   	nop
  1040cf:	90                   	nop

001040d0 <create>:
  return 0;
}

static struct inode*
create(char *path, short type, short major, short minor)
{
  1040d0:	83 ec 5c             	sub    $0x5c,%esp
  1040d3:	89 6c 24 58          	mov    %ebp,0x58(%esp)
  1040d7:	89 cd                	mov    %ecx,%ebp
  1040d9:	8b 4c 24 60          	mov    0x60(%esp),%ecx
  1040dd:	89 74 24 50          	mov    %esi,0x50(%esp)
  uint off;
  struct inode *ip, *dp;
  char name[DIRSIZ];

  if((dp = nameiparent(path, name)) == 0)
  1040e1:	8d 74 24 2e          	lea    0x2e(%esp),%esi
  return 0;
}

static struct inode*
create(char *path, short type, short major, short minor)
{
  1040e5:	89 7c 24 54          	mov    %edi,0x54(%esp)
  1040e9:	89 d7                	mov    %edx,%edi
  1040eb:	89 5c 24 4c          	mov    %ebx,0x4c(%esp)
  1040ef:	89 4c 24 1c          	mov    %ecx,0x1c(%esp)
  uint off;
  struct inode *ip, *dp;
  char name[DIRSIZ];

  if((dp = nameiparent(path, name)) == 0)
  1040f3:	89 74 24 04          	mov    %esi,0x4(%esp)
  1040f7:	89 04 24             	mov    %eax,(%esp)
  1040fa:	e8 51 de ff ff       	call   101f50 <nameiparent>
  1040ff:	85 c0                	test   %eax,%eax
  104101:	0f 84 f1 00 00 00    	je     1041f8 <create+0x128>
    return 0;
  ilock(dp);
  104107:	89 04 24             	mov    %eax,(%esp)
  10410a:	89 44 24 18          	mov    %eax,0x18(%esp)
  10410e:	e8 3d d5 ff ff       	call   101650 <ilock>

  if((ip = dirlookup(dp, name, &off)) != 0){
  104113:	8b 54 24 18          	mov    0x18(%esp),%edx
  104117:	8d 44 24 3c          	lea    0x3c(%esp),%eax
  10411b:	89 44 24 08          	mov    %eax,0x8(%esp)
  10411f:	89 74 24 04          	mov    %esi,0x4(%esp)
  104123:	89 14 24             	mov    %edx,(%esp)
  104126:	e8 a5 da ff ff       	call   101bd0 <dirlookup>
  10412b:	8b 54 24 18          	mov    0x18(%esp),%edx
  10412f:	85 c0                	test   %eax,%eax
  104131:	89 c3                	mov    %eax,%ebx
  104133:	74 43                	je     104178 <create+0xa8>
    iunlockput(dp);
  104135:	89 14 24             	mov    %edx,(%esp)
  104138:	e8 b3 d7 ff ff       	call   1018f0 <iunlockput>
    ilock(ip);
  10413d:	89 1c 24             	mov    %ebx,(%esp)
  104140:	e8 0b d5 ff ff       	call   101650 <ilock>
    if(type == T_FILE && ip->type == T_FILE)
  104145:	66 83 ff 02          	cmp    $0x2,%di
  104149:	75 1d                	jne    104168 <create+0x98>
  10414b:	66 83 7b 10 02       	cmpw   $0x2,0x10(%ebx)
  104150:	75 16                	jne    104168 <create+0x98>
  if(dirlink(dp, name, ip->inum) < 0)
    panic("create: dirlink");

  iunlockput(dp);
  return ip;
}
  104152:	89 d8                	mov    %ebx,%eax
  104154:	8b 74 24 50          	mov    0x50(%esp),%esi
  104158:	8b 5c 24 4c          	mov    0x4c(%esp),%ebx
  10415c:	8b 7c 24 54          	mov    0x54(%esp),%edi
  104160:	8b 6c 24 58          	mov    0x58(%esp),%ebp
  104164:	83 c4 5c             	add    $0x5c,%esp
  104167:	c3                   	ret    
  if((ip = dirlookup(dp, name, &off)) != 0){
    iunlockput(dp);
    ilock(ip);
    if(type == T_FILE && ip->type == T_FILE)
      return ip;
    iunlockput(ip);
  104168:	89 1c 24             	mov    %ebx,(%esp)
    return 0;
  10416b:	31 db                	xor    %ebx,%ebx
  if((ip = dirlookup(dp, name, &off)) != 0){
    iunlockput(dp);
    ilock(ip);
    if(type == T_FILE && ip->type == T_FILE)
      return ip;
    iunlockput(ip);
  10416d:	e8 7e d7 ff ff       	call   1018f0 <iunlockput>
    return 0;
  104172:	eb de                	jmp    104152 <create+0x82>
  104174:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  }

  if((ip = ialloc(dp->dev, type)) == 0)
  104178:	0f bf c7             	movswl %di,%eax
  10417b:	89 44 24 04          	mov    %eax,0x4(%esp)
  10417f:	8b 02                	mov    (%edx),%eax
  104181:	89 54 24 18          	mov    %edx,0x18(%esp)
  104185:	89 04 24             	mov    %eax,(%esp)
  104188:	e8 33 d3 ff ff       	call   1014c0 <ialloc>
  10418d:	8b 54 24 18          	mov    0x18(%esp),%edx
  104191:	85 c0                	test   %eax,%eax
  104193:	89 c3                	mov    %eax,%ebx
  104195:	0f 84 d0 00 00 00    	je     10426b <create+0x19b>
    panic("create: ialloc");

  ilock(ip);
  10419b:	89 54 24 18          	mov    %edx,0x18(%esp)
  10419f:	89 04 24             	mov    %eax,(%esp)
  1041a2:	e8 a9 d4 ff ff       	call   101650 <ilock>
  ip->major = major;
  ip->minor = minor;
  1041a7:	0f b7 44 24 1c       	movzwl 0x1c(%esp),%eax

  if((ip = ialloc(dp->dev, type)) == 0)
    panic("create: ialloc");

  ilock(ip);
  ip->major = major;
  1041ac:	66 89 6b 12          	mov    %bp,0x12(%ebx)
  ip->minor = minor;
  ip->nlink = 1;
  1041b0:	66 c7 43 16 01 00    	movw   $0x1,0x16(%ebx)
  if((ip = ialloc(dp->dev, type)) == 0)
    panic("create: ialloc");

  ilock(ip);
  ip->major = major;
  ip->minor = minor;
  1041b6:	66 89 43 14          	mov    %ax,0x14(%ebx)
  ip->nlink = 1;
  iupdate(ip);
  1041ba:	89 1c 24             	mov    %ebx,(%esp)
  1041bd:	e8 ce d3 ff ff       	call   101590 <iupdate>

  if(type == T_DIR){  // Create . and .. entries.
  1041c2:	66 83 ff 01          	cmp    $0x1,%di
  1041c6:	8b 54 24 18          	mov    0x18(%esp),%edx
  1041ca:	74 34                	je     104200 <create+0x130>
    // No ip->nlink++ for ".": avoid cyclic ref count.
    if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
      panic("create dots");
  }

  if(dirlink(dp, name, ip->inum) < 0)
  1041cc:	8b 43 04             	mov    0x4(%ebx),%eax
  1041cf:	89 14 24             	mov    %edx,(%esp)
  1041d2:	89 54 24 18          	mov    %edx,0x18(%esp)
  1041d6:	89 74 24 04          	mov    %esi,0x4(%esp)
  1041da:	89 44 24 08          	mov    %eax,0x8(%esp)
  1041de:	e8 6d dc ff ff       	call   101e50 <dirlink>
  1041e3:	8b 54 24 18          	mov    0x18(%esp),%edx
  1041e7:	85 c0                	test   %eax,%eax
  1041e9:	78 74                	js     10425f <create+0x18f>
    panic("create: dirlink");

  iunlockput(dp);
  1041eb:	89 14 24             	mov    %edx,(%esp)
  1041ee:	e8 fd d6 ff ff       	call   1018f0 <iunlockput>
  return ip;
  1041f3:	e9 5a ff ff ff       	jmp    104152 <create+0x82>
  uint off;
  struct inode *ip, *dp;
  char name[DIRSIZ];

  if((dp = nameiparent(path, name)) == 0)
    return 0;
  1041f8:	31 db                	xor    %ebx,%ebx
  1041fa:	e9 53 ff ff ff       	jmp    104152 <create+0x82>
  1041ff:	90                   	nop
  ip->minor = minor;
  ip->nlink = 1;
  iupdate(ip);

  if(type == T_DIR){  // Create . and .. entries.
    dp->nlink++;  // for ".."
  104200:	66 83 42 16 01       	addw   $0x1,0x16(%edx)
    iupdate(dp);
  104205:	89 14 24             	mov    %edx,(%esp)
  104208:	89 54 24 18          	mov    %edx,0x18(%esp)
  10420c:	e8 7f d3 ff ff       	call   101590 <iupdate>
    // No ip->nlink++ for ".": avoid cyclic ref count.
    if(dirlink(ip, ".", ip->inum) < 0 || dirlink(ip, "..", dp->inum) < 0)
  104211:	8b 43 04             	mov    0x4(%ebx),%eax
  104214:	c7 44 24 04 64 63 10 	movl   $0x106364,0x4(%esp)
  10421b:	00 
  10421c:	89 1c 24             	mov    %ebx,(%esp)
  10421f:	89 44 24 08          	mov    %eax,0x8(%esp)
  104223:	e8 28 dc ff ff       	call   101e50 <dirlink>
  104228:	8b 54 24 18          	mov    0x18(%esp),%edx
  10422c:	85 c0                	test   %eax,%eax
  10422e:	78 23                	js     104253 <create+0x183>
  104230:	8b 42 04             	mov    0x4(%edx),%eax
  104233:	c7 44 24 04 63 63 10 	movl   $0x106363,0x4(%esp)
  10423a:	00 
  10423b:	89 1c 24             	mov    %ebx,(%esp)
  10423e:	89 44 24 08          	mov    %eax,0x8(%esp)
  104242:	e8 09 dc ff ff       	call   101e50 <dirlink>
  104247:	8b 54 24 18          	mov    0x18(%esp),%edx
  10424b:	85 c0                	test   %eax,%eax
  10424d:	0f 89 79 ff ff ff    	jns    1041cc <create+0xfc>
      panic("create dots");
  104253:	c7 04 24 66 63 10 00 	movl   $0x106366,(%esp)
  10425a:	e8 41 c5 ff ff       	call   1007a0 <panic>
  }

  if(dirlink(dp, name, ip->inum) < 0)
    panic("create: dirlink");
  10425f:	c7 04 24 72 63 10 00 	movl   $0x106372,(%esp)
  104266:	e8 35 c5 ff ff       	call   1007a0 <panic>
    iunlockput(ip);
    return 0;
  }

  if((ip = ialloc(dp->dev, type)) == 0)
    panic("create: ialloc");
  10426b:	c7 04 24 54 63 10 00 	movl   $0x106354,(%esp)
  104272:	e8 29 c5 ff ff       	call   1007a0 <panic>
  104277:	89 f6                	mov    %esi,%esi
  104279:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00104280 <argfd.constprop.0>:
#include "fcntl.h"

// Fetch the nth word-sized system call argument as a file descriptor
// and return both the descriptor and the corresponding struct file.
static int
argfd(int n, int *pfd, struct file **pf)
  104280:	56                   	push   %esi
  104281:	89 d6                	mov    %edx,%esi
  104283:	53                   	push   %ebx
  104284:	89 c3                	mov    %eax,%ebx
  104286:	83 ec 24             	sub    $0x24,%esp
{
  int fd;
  struct file *f;

  if(argint(n, &fd) < 0)
  104289:	8d 44 24 1c          	lea    0x1c(%esp),%eax
  10428d:	89 44 24 04          	mov    %eax,0x4(%esp)
  104291:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  104298:	e8 a3 fc ff ff       	call   103f40 <argint>
  10429d:	85 c0                	test   %eax,%eax
  10429f:	78 37                	js     1042d8 <argfd.constprop.0+0x58>
    return -1;
  if(fd < 0 || fd >= NOFILE || (f=proc->ofile[fd]) == 0)
  1042a1:	8b 54 24 1c          	mov    0x1c(%esp),%edx
    return -1;
  1042a5:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
  int fd;
  struct file *f;

  if(argint(n, &fd) < 0)
    return -1;
  if(fd < 0 || fd >= NOFILE || (f=proc->ofile[fd]) == 0)
  1042aa:	83 fa 0f             	cmp    $0xf,%edx
  1042ad:	77 1d                	ja     1042cc <argfd.constprop.0+0x4c>
  1042af:	65 8b 0d 04 00 00 00 	mov    %gs:0x4,%ecx
  1042b6:	8b 4c 91 28          	mov    0x28(%ecx,%edx,4),%ecx
  1042ba:	85 c9                	test   %ecx,%ecx
  1042bc:	74 0e                	je     1042cc <argfd.constprop.0+0x4c>
    return -1;
  if(pfd)
  1042be:	85 db                	test   %ebx,%ebx
  1042c0:	74 02                	je     1042c4 <argfd.constprop.0+0x44>
    *pfd = fd;
  1042c2:	89 13                	mov    %edx,(%ebx)
  if(pf)
    *pf = f;
  return 0;
  1042c4:	31 c0                	xor    %eax,%eax
    return -1;
  if(fd < 0 || fd >= NOFILE || (f=proc->ofile[fd]) == 0)
    return -1;
  if(pfd)
    *pfd = fd;
  if(pf)
  1042c6:	85 f6                	test   %esi,%esi
  1042c8:	74 02                	je     1042cc <argfd.constprop.0+0x4c>
    *pf = f;
  1042ca:	89 0e                	mov    %ecx,(%esi)
  return 0;
}
  1042cc:	83 c4 24             	add    $0x24,%esp
  1042cf:	5b                   	pop    %ebx
  1042d0:	5e                   	pop    %esi
  1042d1:	c3                   	ret    
  1042d2:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
{
  int fd;
  struct file *f;

  if(argint(n, &fd) < 0)
    return -1;
  1042d8:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
  1042dd:	eb ed                	jmp    1042cc <argfd.constprop.0+0x4c>
  1042df:	90                   	nop

001042e0 <sys_dup>:
  return -1;
}

int
sys_dup(void)
{
  1042e0:	53                   	push   %ebx
  struct file *f;
  int fd;
  
  if(argfd(0, 0, &f) < 0)
  1042e1:	31 c0                	xor    %eax,%eax
  return -1;
}

int
sys_dup(void)
{
  1042e3:	83 ec 28             	sub    $0x28,%esp
  struct file *f;
  int fd;
  
  if(argfd(0, 0, &f) < 0)
  1042e6:	8d 54 24 1c          	lea    0x1c(%esp),%edx
  1042ea:	e8 91 ff ff ff       	call   104280 <argfd.constprop.0>
  1042ef:	85 c0                	test   %eax,%eax
  1042f1:	78 1d                	js     104310 <sys_dup+0x30>
    return -1;
  if((fd=fdalloc(f)) < 0)
  1042f3:	8b 54 24 1c          	mov    0x1c(%esp),%edx
static int
fdalloc(struct file *f)
{
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
  1042f7:	31 db                	xor    %ebx,%ebx
  struct file *f;
  int fd;
  
  if(argfd(0, 0, &f) < 0)
    return -1;
  if((fd=fdalloc(f)) < 0)
  1042f9:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  1042ff:	90                   	nop
fdalloc(struct file *f)
{
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
    if(proc->ofile[fd] == 0){
  104300:	8b 4c 98 28          	mov    0x28(%eax,%ebx,4),%ecx
  104304:	85 c9                	test   %ecx,%ecx
  104306:	74 18                	je     104320 <sys_dup+0x40>
static int
fdalloc(struct file *f)
{
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
  104308:	83 c3 01             	add    $0x1,%ebx
  10430b:	83 fb 10             	cmp    $0x10,%ebx
  10430e:	75 f0                	jne    104300 <sys_dup+0x20>
{
  struct file *f;
  int fd;
  
  if(argfd(0, 0, &f) < 0)
    return -1;
  104310:	bb ff ff ff ff       	mov    $0xffffffff,%ebx
  if((fd=fdalloc(f)) < 0)
    return -1;
  filedup(f);
  return fd;
}
  104315:	83 c4 28             	add    $0x28,%esp
  104318:	89 d8                	mov    %ebx,%eax
  10431a:	5b                   	pop    %ebx
  10431b:	c3                   	ret    
  10431c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
{
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
    if(proc->ofile[fd] == 0){
      proc->ofile[fd] = f;
  104320:	89 54 98 28          	mov    %edx,0x28(%eax,%ebx,4)
  
  if(argfd(0, 0, &f) < 0)
    return -1;
  if((fd=fdalloc(f)) < 0)
    return -1;
  filedup(f);
  104324:	89 14 24             	mov    %edx,(%esp)
  104327:	e8 54 cb ff ff       	call   100e80 <filedup>
  return fd;
}
  10432c:	83 c4 28             	add    $0x28,%esp
  10432f:	89 d8                	mov    %ebx,%eax
  104331:	5b                   	pop    %ebx
  104332:	c3                   	ret    
  104333:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  104339:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00104340 <sys_read>:

int
sys_read(void)
{
  104340:	53                   	push   %ebx
  struct file *f;
  int n;
  char *p;

  if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
  104341:	31 c0                	xor    %eax,%eax
  return fd;
}

int
sys_read(void)
{
  104343:	83 ec 28             	sub    $0x28,%esp
  struct file *f;
  int n;
  char *p;

  if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
    return -1;
  104346:	bb ff ff ff ff       	mov    $0xffffffff,%ebx
{
  struct file *f;
  int n;
  char *p;

  if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
  10434b:	8d 54 24 14          	lea    0x14(%esp),%edx
  10434f:	e8 2c ff ff ff       	call   104280 <argfd.constprop.0>
  104354:	85 c0                	test   %eax,%eax
  104356:	78 56                	js     1043ae <sys_read+0x6e>
  104358:	8d 44 24 18          	lea    0x18(%esp),%eax
  10435c:	89 44 24 04          	mov    %eax,0x4(%esp)
  104360:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
  104367:	e8 d4 fb ff ff       	call   103f40 <argint>
  10436c:	85 c0                	test   %eax,%eax
  10436e:	78 3e                	js     1043ae <sys_read+0x6e>
  104370:	8b 44 24 18          	mov    0x18(%esp),%eax
  104374:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  10437b:	89 44 24 08          	mov    %eax,0x8(%esp)
  10437f:	8d 44 24 1c          	lea    0x1c(%esp),%eax
  104383:	89 44 24 04          	mov    %eax,0x4(%esp)
  104387:	e8 04 fc ff ff       	call   103f90 <argptr>
  10438c:	85 c0                	test   %eax,%eax
  10438e:	78 1e                	js     1043ae <sys_read+0x6e>
    return -1;
  return fileread(f, p, n);
  104390:	8b 44 24 18          	mov    0x18(%esp),%eax
  104394:	89 44 24 08          	mov    %eax,0x8(%esp)
  104398:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  10439c:	89 44 24 04          	mov    %eax,0x4(%esp)
  1043a0:	8b 44 24 14          	mov    0x14(%esp),%eax
  1043a4:	89 04 24             	mov    %eax,(%esp)
  1043a7:	e8 44 cc ff ff       	call   100ff0 <fileread>
  1043ac:	89 c3                	mov    %eax,%ebx
}
  1043ae:	83 c4 28             	add    $0x28,%esp
  1043b1:	89 d8                	mov    %ebx,%eax
  1043b3:	5b                   	pop    %ebx
  1043b4:	c3                   	ret    
  1043b5:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  1043b9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

001043c0 <sys_write>:

int
sys_write(void)
{
  1043c0:	53                   	push   %ebx
  struct file *f;
  int n;
  char *p;

  if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
  1043c1:	31 c0                	xor    %eax,%eax
  return fileread(f, p, n);
}

int
sys_write(void)
{
  1043c3:	83 ec 28             	sub    $0x28,%esp
  struct file *f;
  int n;
  char *p;

  if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
    return -1;
  1043c6:	bb ff ff ff ff       	mov    $0xffffffff,%ebx
{
  struct file *f;
  int n;
  char *p;

  if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argptr(1, &p, n) < 0)
  1043cb:	8d 54 24 14          	lea    0x14(%esp),%edx
  1043cf:	e8 ac fe ff ff       	call   104280 <argfd.constprop.0>
  1043d4:	85 c0                	test   %eax,%eax
  1043d6:	78 56                	js     10442e <sys_write+0x6e>
  1043d8:	8d 44 24 18          	lea    0x18(%esp),%eax
  1043dc:	89 44 24 04          	mov    %eax,0x4(%esp)
  1043e0:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
  1043e7:	e8 54 fb ff ff       	call   103f40 <argint>
  1043ec:	85 c0                	test   %eax,%eax
  1043ee:	78 3e                	js     10442e <sys_write+0x6e>
  1043f0:	8b 44 24 18          	mov    0x18(%esp),%eax
  1043f4:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  1043fb:	89 44 24 08          	mov    %eax,0x8(%esp)
  1043ff:	8d 44 24 1c          	lea    0x1c(%esp),%eax
  104403:	89 44 24 04          	mov    %eax,0x4(%esp)
  104407:	e8 84 fb ff ff       	call   103f90 <argptr>
  10440c:	85 c0                	test   %eax,%eax
  10440e:	78 1e                	js     10442e <sys_write+0x6e>
    return -1;
  return filewrite(f, p, n);
  104410:	8b 44 24 18          	mov    0x18(%esp),%eax
  104414:	89 44 24 08          	mov    %eax,0x8(%esp)
  104418:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  10441c:	89 44 24 04          	mov    %eax,0x4(%esp)
  104420:	8b 44 24 14          	mov    0x14(%esp),%eax
  104424:	89 04 24             	mov    %eax,(%esp)
  104427:	e8 74 cc ff ff       	call   1010a0 <filewrite>
  10442c:	89 c3                	mov    %eax,%ebx
}
  10442e:	83 c4 28             	add    $0x28,%esp
  104431:	89 d8                	mov    %ebx,%eax
  104433:	5b                   	pop    %ebx
  104434:	c3                   	ret    
  104435:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  104439:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00104440 <sys_close>:

int
sys_close(void)
{
  104440:	83 ec 2c             	sub    $0x2c,%esp
  int fd;
  struct file *f;
  
  if(argfd(0, &fd, &f) < 0)
  104443:	8d 54 24 1c          	lea    0x1c(%esp),%edx
  104447:	8d 44 24 18          	lea    0x18(%esp),%eax
  10444b:	e8 30 fe ff ff       	call   104280 <argfd.constprop.0>
    return -1;
  104450:	ba ff ff ff ff       	mov    $0xffffffff,%edx
sys_close(void)
{
  int fd;
  struct file *f;
  
  if(argfd(0, &fd, &f) < 0)
  104455:	85 c0                	test   %eax,%eax
  104457:	78 20                	js     104479 <sys_close+0x39>
    return -1;
  proc->ofile[fd] = 0;
  104459:	8b 54 24 18          	mov    0x18(%esp),%edx
  10445d:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  104463:	c7 44 90 28 00 00 00 	movl   $0x0,0x28(%eax,%edx,4)
  10446a:	00 
  fileclose(f);
  10446b:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  10446f:	89 04 24             	mov    %eax,(%esp)
  104472:	e8 49 ca ff ff       	call   100ec0 <fileclose>
  return 0;
  104477:	31 d2                	xor    %edx,%edx
}
  104479:	89 d0                	mov    %edx,%eax
  10447b:	83 c4 2c             	add    $0x2c,%esp
  10447e:	c3                   	ret    
  10447f:	90                   	nop

00104480 <sys_fstat>:

int
sys_fstat(void)
{
  104480:	53                   	push   %ebx
  struct file *f;
  struct statt *st;
  
  if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
  104481:	31 c0                	xor    %eax,%eax
  return 0;
}

int
sys_fstat(void)
{
  104483:	83 ec 28             	sub    $0x28,%esp
  struct file *f;
  struct statt *st;
  
  if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
    return -1;
  104486:	bb ff ff ff ff       	mov    $0xffffffff,%ebx
sys_fstat(void)
{
  struct file *f;
  struct statt *st;
  
  if(argfd(0, 0, &f) < 0 || argptr(1, (void*)&st, sizeof(*st)) < 0)
  10448b:	8d 54 24 18          	lea    0x18(%esp),%edx
  10448f:	e8 ec fd ff ff       	call   104280 <argfd.constprop.0>
  104494:	85 c0                	test   %eax,%eax
  104496:	78 36                	js     1044ce <sys_fstat+0x4e>
  104498:	8d 44 24 1c          	lea    0x1c(%esp),%eax
  10449c:	c7 44 24 08 14 00 00 	movl   $0x14,0x8(%esp)
  1044a3:	00 
  1044a4:	89 44 24 04          	mov    %eax,0x4(%esp)
  1044a8:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  1044af:	e8 dc fa ff ff       	call   103f90 <argptr>
  1044b4:	85 c0                	test   %eax,%eax
  1044b6:	78 16                	js     1044ce <sys_fstat+0x4e>
    return -1;
  return filestat(f, st);
  1044b8:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  1044bc:	89 44 24 04          	mov    %eax,0x4(%esp)
  1044c0:	8b 44 24 18          	mov    0x18(%esp),%eax
  1044c4:	89 04 24             	mov    %eax,(%esp)
  1044c7:	e8 d4 ca ff ff       	call   100fa0 <filestat>
  1044cc:	89 c3                	mov    %eax,%ebx
}
  1044ce:	83 c4 28             	add    $0x28,%esp
  1044d1:	89 d8                	mov    %ebx,%eax
  1044d3:	5b                   	pop    %ebx
  1044d4:	c3                   	ret    
  1044d5:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  1044d9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

001044e0 <sys_link>:

// Create the path new as a link to the same inode as old.
int
sys_link(void)
{
  1044e0:	57                   	push   %edi
  1044e1:	56                   	push   %esi
  char name[DIRSIZ], *new, *old;
  struct inode *dp, *ip;

  if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
    return -1;
  1044e2:	be ff ff ff ff       	mov    $0xffffffff,%esi
}

// Create the path new as a link to the same inode as old.
int
sys_link(void)
{
  1044e7:	53                   	push   %ebx
  1044e8:	83 ec 30             	sub    $0x30,%esp
  char name[DIRSIZ], *new, *old;
  struct inode *dp, *ip;

  if(argstr(0, &old) < 0 || argstr(1, &new) < 0)
  1044eb:	8d 44 24 2c          	lea    0x2c(%esp),%eax
  1044ef:	89 44 24 04          	mov    %eax,0x4(%esp)
  1044f3:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  1044fa:	e8 f1 fa ff ff       	call   103ff0 <argstr>
  1044ff:	85 c0                	test   %eax,%eax
  104501:	0f 88 a7 00 00 00    	js     1045ae <sys_link+0xce>
  104507:	8d 44 24 28          	lea    0x28(%esp),%eax
  10450b:	89 44 24 04          	mov    %eax,0x4(%esp)
  10450f:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  104516:	e8 d5 fa ff ff       	call   103ff0 <argstr>
  10451b:	85 c0                	test   %eax,%eax
  10451d:	0f 88 8b 00 00 00    	js     1045ae <sys_link+0xce>
    return -1;
  if((ip = namei(old)) == 0)
  104523:	8b 44 24 2c          	mov    0x2c(%esp),%eax
  104527:	89 04 24             	mov    %eax,(%esp)
  10452a:	e8 01 da ff ff       	call   101f30 <namei>
  10452f:	85 c0                	test   %eax,%eax
  104531:	89 c3                	mov    %eax,%ebx
  104533:	74 79                	je     1045ae <sys_link+0xce>
    return -1;
  ilock(ip);
  104535:	89 04 24             	mov    %eax,(%esp)
  104538:	e8 13 d1 ff ff       	call   101650 <ilock>
  if(ip->type == T_DIR){
  10453d:	66 83 7b 10 01       	cmpw   $0x1,0x10(%ebx)
  104542:	0f 84 a8 00 00 00    	je     1045f0 <sys_link+0x110>
    iunlockput(ip);
    return -1;
  }
  ip->nlink++;
  104548:	66 83 43 16 01       	addw   $0x1,0x16(%ebx)
  iupdate(ip);
  iunlock(ip);

  if((dp = nameiparent(new, name)) == 0)
  10454d:	8d 7c 24 1a          	lea    0x1a(%esp),%edi
  if(ip->type == T_DIR){
    iunlockput(ip);
    return -1;
  }
  ip->nlink++;
  iupdate(ip);
  104551:	89 1c 24             	mov    %ebx,(%esp)
  104554:	e8 37 d0 ff ff       	call   101590 <iupdate>
  iunlock(ip);
  104559:	89 1c 24             	mov    %ebx,(%esp)
  10455c:	e8 ef d1 ff ff       	call   101750 <iunlock>

  if((dp = nameiparent(new, name)) == 0)
  104561:	8b 44 24 28          	mov    0x28(%esp),%eax
  104565:	89 7c 24 04          	mov    %edi,0x4(%esp)
  104569:	89 04 24             	mov    %eax,(%esp)
  10456c:	e8 df d9 ff ff       	call   101f50 <nameiparent>
  104571:	85 c0                	test   %eax,%eax
  104573:	89 c6                	mov    %eax,%esi
  104575:	74 49                	je     1045c0 <sys_link+0xe0>
    goto bad;
  ilock(dp);
  104577:	89 04 24             	mov    %eax,(%esp)
  10457a:	e8 d1 d0 ff ff       	call   101650 <ilock>
  if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
  10457f:	8b 03                	mov    (%ebx),%eax
  104581:	39 06                	cmp    %eax,(%esi)
  104583:	75 33                	jne    1045b8 <sys_link+0xd8>
  104585:	8b 43 04             	mov    0x4(%ebx),%eax
  104588:	89 7c 24 04          	mov    %edi,0x4(%esp)
  10458c:	89 34 24             	mov    %esi,(%esp)
  10458f:	89 44 24 08          	mov    %eax,0x8(%esp)
  104593:	e8 b8 d8 ff ff       	call   101e50 <dirlink>
  104598:	85 c0                	test   %eax,%eax
  10459a:	78 1c                	js     1045b8 <sys_link+0xd8>
    iunlockput(dp);
    goto bad;
  }
  iunlockput(dp);
  10459c:	89 34 24             	mov    %esi,(%esp)
  iput(ip);
  return 0;
  10459f:	31 f6                	xor    %esi,%esi
  ilock(dp);
  if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
    iunlockput(dp);
    goto bad;
  }
  iunlockput(dp);
  1045a1:	e8 4a d3 ff ff       	call   1018f0 <iunlockput>
  iput(ip);
  1045a6:	89 1c 24             	mov    %ebx,(%esp)
  1045a9:	e8 f2 d1 ff ff       	call   1017a0 <iput>
  ilock(ip);
  ip->nlink--;
  iupdate(ip);
  iunlockput(ip);
  return -1;
}
  1045ae:	83 c4 30             	add    $0x30,%esp
  1045b1:	89 f0                	mov    %esi,%eax
  1045b3:	5b                   	pop    %ebx
  1045b4:	5e                   	pop    %esi
  1045b5:	5f                   	pop    %edi
  1045b6:	c3                   	ret    
  1045b7:	90                   	nop

  if((dp = nameiparent(new, name)) == 0)
    goto bad;
  ilock(dp);
  if(dp->dev != ip->dev || dirlink(dp, name, ip->inum) < 0){
    iunlockput(dp);
  1045b8:	89 34 24             	mov    %esi,(%esp)
  1045bb:	e8 30 d3 ff ff       	call   1018f0 <iunlockput>
  iunlockput(dp);
  iput(ip);
  return 0;

bad:
  ilock(ip);
  1045c0:	89 1c 24             	mov    %ebx,(%esp)
  ip->nlink--;
  iupdate(ip);
  iunlockput(ip);
  return -1;
  1045c3:	be ff ff ff ff       	mov    $0xffffffff,%esi
  iunlockput(dp);
  iput(ip);
  return 0;

bad:
  ilock(ip);
  1045c8:	e8 83 d0 ff ff       	call   101650 <ilock>
  ip->nlink--;
  1045cd:	66 83 6b 16 01       	subw   $0x1,0x16(%ebx)
  iupdate(ip);
  1045d2:	89 1c 24             	mov    %ebx,(%esp)
  1045d5:	e8 b6 cf ff ff       	call   101590 <iupdate>
  iunlockput(ip);
  1045da:	89 1c 24             	mov    %ebx,(%esp)
  1045dd:	e8 0e d3 ff ff       	call   1018f0 <iunlockput>
  return -1;
}
  1045e2:	83 c4 30             	add    $0x30,%esp
  1045e5:	89 f0                	mov    %esi,%eax
  1045e7:	5b                   	pop    %ebx
  1045e8:	5e                   	pop    %esi
  1045e9:	5f                   	pop    %edi
  1045ea:	c3                   	ret    
  1045eb:	90                   	nop
  1045ec:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    return -1;
  if((ip = namei(old)) == 0)
    return -1;
  ilock(ip);
  if(ip->type == T_DIR){
    iunlockput(ip);
  1045f0:	89 1c 24             	mov    %ebx,(%esp)
  1045f3:	e8 f8 d2 ff ff       	call   1018f0 <iunlockput>
    return -1;
  1045f8:	eb b4                	jmp    1045ae <sys_link+0xce>
  1045fa:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi

00104600 <sys_unlink>:
  return 1;
}

int
sys_unlink(void)
{
  104600:	55                   	push   %ebp
  104601:	57                   	push   %edi
  104602:	56                   	push   %esi
  104603:	53                   	push   %ebx
  104604:	83 ec 5c             	sub    $0x5c,%esp
  struct inode *ip, *dp;
  struct dirent de;
  char name[DIRSIZ], *path;
  uint off;

  if(argstr(0, &path) < 0)
  104607:	8d 44 24 48          	lea    0x48(%esp),%eax
  10460b:	89 44 24 04          	mov    %eax,0x4(%esp)
  10460f:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  104616:	e8 d5 f9 ff ff       	call   103ff0 <argstr>
  10461b:	85 c0                	test   %eax,%eax
  10461d:	0f 88 7f 01 00 00    	js     1047a2 <sys_unlink+0x1a2>
    return -1;
  if((dp = nameiparent(path, name)) == 0)
  104623:	8b 44 24 48          	mov    0x48(%esp),%eax
  104627:	8d 5c 24 3a          	lea    0x3a(%esp),%ebx
  10462b:	89 5c 24 04          	mov    %ebx,0x4(%esp)
  10462f:	89 04 24             	mov    %eax,(%esp)
  104632:	e8 19 d9 ff ff       	call   101f50 <nameiparent>
  104637:	85 c0                	test   %eax,%eax
  104639:	89 c5                	mov    %eax,%ebp
  10463b:	0f 84 61 01 00 00    	je     1047a2 <sys_unlink+0x1a2>
    return -1;
  ilock(dp);
  104641:	89 04 24             	mov    %eax,(%esp)
  104644:	e8 07 d0 ff ff       	call   101650 <ilock>

  // Cannot unlink "." or "..".
  if(namecmp(name, ".") == 0 || namecmp(name, "..") == 0){
  104649:	c7 44 24 04 64 63 10 	movl   $0x106364,0x4(%esp)
  104650:	00 
  104651:	89 1c 24             	mov    %ebx,(%esp)
  104654:	e8 47 d5 ff ff       	call   101ba0 <namecmp>
  104659:	85 c0                	test   %eax,%eax
  10465b:	0f 84 18 01 00 00    	je     104779 <sys_unlink+0x179>
  104661:	c7 44 24 04 63 63 10 	movl   $0x106363,0x4(%esp)
  104668:	00 
  104669:	89 1c 24             	mov    %ebx,(%esp)
  10466c:	e8 2f d5 ff ff       	call   101ba0 <namecmp>
  104671:	85 c0                	test   %eax,%eax
  104673:	0f 84 00 01 00 00    	je     104779 <sys_unlink+0x179>
    iunlockput(dp);
    return -1;
  }

  if((ip = dirlookup(dp, name, &off)) == 0){
  104679:	8d 44 24 4c          	lea    0x4c(%esp),%eax
  10467d:	89 44 24 08          	mov    %eax,0x8(%esp)
  104681:	89 5c 24 04          	mov    %ebx,0x4(%esp)
  104685:	89 2c 24             	mov    %ebp,(%esp)
  104688:	e8 43 d5 ff ff       	call   101bd0 <dirlookup>
  10468d:	85 c0                	test   %eax,%eax
  10468f:	89 c6                	mov    %eax,%esi
  104691:	0f 84 e2 00 00 00    	je     104779 <sys_unlink+0x179>
    iunlockput(dp);
    return -1;
  }
  ilock(ip);
  104697:	89 04 24             	mov    %eax,(%esp)
  10469a:	e8 b1 cf ff ff       	call   101650 <ilock>

  if(ip->nlink < 1)
  10469f:	66 83 7e 16 00       	cmpw   $0x0,0x16(%esi)
  1046a4:	0f 8e 1a 01 00 00    	jle    1047c4 <sys_unlink+0x1c4>
    panic("unlink: nlink < 1");
  if(ip->type == T_DIR && !isdirempty(ip)){
  1046aa:	66 83 7e 10 01       	cmpw   $0x1,0x10(%esi)
  1046af:	74 77                	je     104728 <sys_unlink+0x128>
    iunlockput(ip);
    iunlockput(dp);
    return -1;
  }

  memset(&de, 0, sizeof(de));
  1046b1:	8d 5c 24 1a          	lea    0x1a(%esp),%ebx
  1046b5:	c7 44 24 08 10 00 00 	movl   $0x10,0x8(%esp)
  1046bc:	00 
  1046bd:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  1046c4:	00 
  1046c5:	89 1c 24             	mov    %ebx,(%esp)
  1046c8:	e8 b3 f5 ff ff       	call   103c80 <memset>
  if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
  1046cd:	8b 44 24 4c          	mov    0x4c(%esp),%eax
  1046d1:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
  1046d8:	00 
  1046d9:	89 5c 24 04          	mov    %ebx,0x4(%esp)
  1046dd:	89 2c 24             	mov    %ebp,(%esp)
  1046e0:	89 44 24 08          	mov    %eax,0x8(%esp)
  1046e4:	e8 67 d3 ff ff       	call   101a50 <writei>
  1046e9:	83 f8 10             	cmp    $0x10,%eax
  1046ec:	0f 85 c6 00 00 00    	jne    1047b8 <sys_unlink+0x1b8>
    panic("unlink: writei");
  if(ip->type == T_DIR){
  1046f2:	66 83 7e 10 01       	cmpw   $0x1,0x10(%esi)
  1046f7:	0f 84 93 00 00 00    	je     104790 <sys_unlink+0x190>
    dp->nlink--;
    iupdate(dp);
  }
  iunlockput(dp);
  1046fd:	89 2c 24             	mov    %ebp,(%esp)
  104700:	e8 eb d1 ff ff       	call   1018f0 <iunlockput>

  ip->nlink--;
  104705:	66 83 6e 16 01       	subw   $0x1,0x16(%esi)
  iupdate(ip);
  10470a:	89 34 24             	mov    %esi,(%esp)
  10470d:	e8 7e ce ff ff       	call   101590 <iupdate>
  iunlockput(ip);
  104712:	89 34 24             	mov    %esi,(%esp)
  104715:	e8 d6 d1 ff ff       	call   1018f0 <iunlockput>
  return 0;
  10471a:	31 c0                	xor    %eax,%eax
}
  10471c:	83 c4 5c             	add    $0x5c,%esp
  10471f:	5b                   	pop    %ebx
  104720:	5e                   	pop    %esi
  104721:	5f                   	pop    %edi
  104722:	5d                   	pop    %ebp
  104723:	c3                   	ret    
  104724:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
isdirempty(struct inode *dp)
{
  int off;
  struct dirent de;

  for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
  104728:	83 7e 18 20          	cmpl   $0x20,0x18(%esi)
  10472c:	76 83                	jbe    1046b1 <sys_unlink+0xb1>
  10472e:	bb 20 00 00 00       	mov    $0x20,%ebx
  104733:	8d 7c 24 2a          	lea    0x2a(%esp),%edi
  104737:	eb 13                	jmp    10474c <sys_unlink+0x14c>
  104739:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  104740:	83 c3 10             	add    $0x10,%ebx
  104743:	3b 5e 18             	cmp    0x18(%esi),%ebx
  104746:	0f 83 65 ff ff ff    	jae    1046b1 <sys_unlink+0xb1>
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
  10474c:	c7 44 24 0c 10 00 00 	movl   $0x10,0xc(%esp)
  104753:	00 
  104754:	89 5c 24 08          	mov    %ebx,0x8(%esp)
  104758:	89 7c 24 04          	mov    %edi,0x4(%esp)
  10475c:	89 34 24             	mov    %esi,(%esp)
  10475f:	e8 dc d1 ff ff       	call   101940 <readi>
  104764:	83 f8 10             	cmp    $0x10,%eax
  104767:	75 43                	jne    1047ac <sys_unlink+0x1ac>
      panic("isdirempty: readi");
    if(de.inum != 0)
  104769:	66 83 7c 24 2a 00    	cmpw   $0x0,0x2a(%esp)
  10476f:	74 cf                	je     104740 <sys_unlink+0x140>
  ilock(ip);

  if(ip->nlink < 1)
    panic("unlink: nlink < 1");
  if(ip->type == T_DIR && !isdirempty(ip)){
    iunlockput(ip);
  104771:	89 34 24             	mov    %esi,(%esp)
  104774:	e8 77 d1 ff ff       	call   1018f0 <iunlockput>
    iunlockput(dp);
  104779:	89 2c 24             	mov    %ebp,(%esp)
  10477c:	e8 6f d1 ff ff       	call   1018f0 <iunlockput>

  ip->nlink--;
  iupdate(ip);
  iunlockput(ip);
  return 0;
}
  104781:	83 c4 5c             	add    $0x5c,%esp
  if(ip->nlink < 1)
    panic("unlink: nlink < 1");
  if(ip->type == T_DIR && !isdirempty(ip)){
    iunlockput(ip);
    iunlockput(dp);
    return -1;
  104784:	b8 ff ff ff ff       	mov    $0xffffffff,%eax

  ip->nlink--;
  iupdate(ip);
  iunlockput(ip);
  return 0;
}
  104789:	5b                   	pop    %ebx
  10478a:	5e                   	pop    %esi
  10478b:	5f                   	pop    %edi
  10478c:	5d                   	pop    %ebp
  10478d:	c3                   	ret    
  10478e:	66 90                	xchg   %ax,%ax

  memset(&de, 0, sizeof(de));
  if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
    panic("unlink: writei");
  if(ip->type == T_DIR){
    dp->nlink--;
  104790:	66 83 6d 16 01       	subw   $0x1,0x16(%ebp)
    iupdate(dp);
  104795:	89 2c 24             	mov    %ebp,(%esp)
  104798:	e8 f3 cd ff ff       	call   101590 <iupdate>
  10479d:	e9 5b ff ff ff       	jmp    1046fd <sys_unlink+0xfd>
  uint off;

  if(argstr(0, &path) < 0)
    return -1;
  if((dp = nameiparent(path, name)) == 0)
    return -1;
  1047a2:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
  1047a7:	e9 70 ff ff ff       	jmp    10471c <sys_unlink+0x11c>
  int off;
  struct dirent de;

  for(off=2*sizeof(de); off<dp->size; off+=sizeof(de)){
    if(readi(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
      panic("isdirempty: readi");
  1047ac:	c7 04 24 94 63 10 00 	movl   $0x106394,(%esp)
  1047b3:	e8 e8 bf ff ff       	call   1007a0 <panic>
    return -1;
  }

  memset(&de, 0, sizeof(de));
  if(writei(dp, (char*)&de, off, sizeof(de)) != sizeof(de))
    panic("unlink: writei");
  1047b8:	c7 04 24 a6 63 10 00 	movl   $0x1063a6,(%esp)
  1047bf:	e8 dc bf ff ff       	call   1007a0 <panic>
    return -1;
  }
  ilock(ip);

  if(ip->nlink < 1)
    panic("unlink: nlink < 1");
  1047c4:	c7 04 24 82 63 10 00 	movl   $0x106382,(%esp)
  1047cb:	e8 d0 bf ff ff       	call   1007a0 <panic>

001047d0 <sys_open>:
  return ip;
}

int
sys_open(void)
{
  1047d0:	57                   	push   %edi
  1047d1:	56                   	push   %esi
  1047d2:	53                   	push   %ebx
  int fd, omode;
  struct file *f;
  struct inode *ip;

  if(argstr(0, &path) < 0 || argint(1, &omode) < 0)
    return -1;
  1047d3:	bb ff ff ff ff       	mov    $0xffffffff,%ebx
  return ip;
}

int
sys_open(void)
{
  1047d8:	83 ec 20             	sub    $0x20,%esp
  char *path;
  int fd, omode;
  struct file *f;
  struct inode *ip;

  if(argstr(0, &path) < 0 || argint(1, &omode) < 0)
  1047db:	8d 44 24 18          	lea    0x18(%esp),%eax
  1047df:	89 44 24 04          	mov    %eax,0x4(%esp)
  1047e3:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  1047ea:	e8 01 f8 ff ff       	call   103ff0 <argstr>
  1047ef:	85 c0                	test   %eax,%eax
  1047f1:	0f 88 7e 00 00 00    	js     104875 <sys_open+0xa5>
  1047f7:	8d 44 24 1c          	lea    0x1c(%esp),%eax
  1047fb:	89 44 24 04          	mov    %eax,0x4(%esp)
  1047ff:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  104806:	e8 35 f7 ff ff       	call   103f40 <argint>
  10480b:	85 c0                	test   %eax,%eax
  10480d:	78 66                	js     104875 <sys_open+0xa5>
    return -1;

  if(omode & O_CREATE){
  10480f:	f6 44 24 1d 02       	testb  $0x2,0x1d(%esp)
  104814:	75 6a                	jne    104880 <sys_open+0xb0>
    if((ip = create(path, T_FILE, 0, 0)) == 0)
      return -1;
  } else {
    if((ip = namei(path)) == 0)
  104816:	8b 44 24 18          	mov    0x18(%esp),%eax
  10481a:	89 04 24             	mov    %eax,(%esp)
  10481d:	e8 0e d7 ff ff       	call   101f30 <namei>
  104822:	85 c0                	test   %eax,%eax
  104824:	89 c6                	mov    %eax,%esi
  104826:	74 4d                	je     104875 <sys_open+0xa5>
      return -1;
    ilock(ip);
  104828:	89 04 24             	mov    %eax,(%esp)
  10482b:	e8 20 ce ff ff       	call   101650 <ilock>
    if(ip->type == T_DIR && omode != O_RDONLY){
  104830:	66 83 7e 10 01       	cmpw   $0x1,0x10(%esi)
  104835:	0f 84 9d 00 00 00    	je     1048d8 <sys_open+0x108>
      iunlockput(ip);
      return -1;
    }
  }

  if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
  10483b:	e8 d0 c5 ff ff       	call   100e10 <filealloc>
  104840:	85 c0                	test   %eax,%eax
  104842:	89 c7                	mov    %eax,%edi
  104844:	74 22                	je     104868 <sys_open+0x98>
  104846:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
  10484d:	31 db                	xor    %ebx,%ebx
  10484f:	90                   	nop
fdalloc(struct file *f)
{
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
    if(proc->ofile[fd] == 0){
  104850:	8b 44 9a 28          	mov    0x28(%edx,%ebx,4),%eax
  104854:	85 c0                	test   %eax,%eax
  104856:	74 48                	je     1048a0 <sys_open+0xd0>
static int
fdalloc(struct file *f)
{
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
  104858:	83 c3 01             	add    $0x1,%ebx
  10485b:	83 fb 10             	cmp    $0x10,%ebx
  10485e:	75 f0                	jne    104850 <sys_open+0x80>
    }
  }

  if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
    if(f)
      fileclose(f);
  104860:	89 3c 24             	mov    %edi,(%esp)
  104863:	e8 58 c6 ff ff       	call   100ec0 <fileclose>
    iunlockput(ip);
  104868:	89 34 24             	mov    %esi,(%esp)
    return -1;
  10486b:	bb ff ff ff ff       	mov    $0xffffffff,%ebx
  }

  if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
    if(f)
      fileclose(f);
    iunlockput(ip);
  104870:	e8 7b d0 ff ff       	call   1018f0 <iunlockput>
  f->off = 0;
  f->readable = !(omode & O_WRONLY);
  f->writable = (omode & O_WRONLY) || (omode & O_RDWR);

  return fd;
}
  104875:	83 c4 20             	add    $0x20,%esp
  104878:	89 d8                	mov    %ebx,%eax
  10487a:	5b                   	pop    %ebx
  10487b:	5e                   	pop    %esi
  10487c:	5f                   	pop    %edi
  10487d:	c3                   	ret    
  10487e:	66 90                	xchg   %ax,%ax

  if(argstr(0, &path) < 0 || argint(1, &omode) < 0)
    return -1;

  if(omode & O_CREATE){
    if((ip = create(path, T_FILE, 0, 0)) == 0)
  104880:	8b 44 24 18          	mov    0x18(%esp),%eax
  104884:	31 c9                	xor    %ecx,%ecx
  104886:	ba 02 00 00 00       	mov    $0x2,%edx
  10488b:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  104892:	e8 39 f8 ff ff       	call   1040d0 <create>
  104897:	85 c0                	test   %eax,%eax
  104899:	89 c6                	mov    %eax,%esi
  10489b:	75 9e                	jne    10483b <sys_open+0x6b>
  10489d:	eb d6                	jmp    104875 <sys_open+0xa5>
  10489f:	90                   	nop
{
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
    if(proc->ofile[fd] == 0){
      proc->ofile[fd] = f;
  1048a0:	89 7c 9a 28          	mov    %edi,0x28(%edx,%ebx,4)
    if(f)
      fileclose(f);
    iunlockput(ip);
    return -1;
  }
  iunlock(ip);
  1048a4:	89 34 24             	mov    %esi,(%esp)
  1048a7:	e8 a4 ce ff ff       	call   101750 <iunlock>

  f->type = FD_INODE;
  1048ac:	c7 07 02 00 00 00    	movl   $0x2,(%edi)
  f->ip = ip;
  f->off = 0;
  f->readable = !(omode & O_WRONLY);
  1048b2:	8b 44 24 1c          	mov    0x1c(%esp),%eax
    return -1;
  }
  iunlock(ip);

  f->type = FD_INODE;
  f->ip = ip;
  1048b6:	89 77 10             	mov    %esi,0x10(%edi)
  f->off = 0;
  1048b9:	c7 47 14 00 00 00 00 	movl   $0x0,0x14(%edi)
  f->readable = !(omode & O_WRONLY);
  1048c0:	a8 01                	test   $0x1,%al
  1048c2:	0f 94 47 08          	sete   0x8(%edi)
  f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
  1048c6:	a8 03                	test   $0x3,%al
  1048c8:	0f 95 47 09          	setne  0x9(%edi)

  return fd;
}
  1048cc:	83 c4 20             	add    $0x20,%esp
  1048cf:	89 d8                	mov    %ebx,%eax
  1048d1:	5b                   	pop    %ebx
  1048d2:	5e                   	pop    %esi
  1048d3:	5f                   	pop    %edi
  1048d4:	c3                   	ret    
  1048d5:	8d 76 00             	lea    0x0(%esi),%esi
      return -1;
  } else {
    if((ip = namei(path)) == 0)
      return -1;
    ilock(ip);
    if(ip->type == T_DIR && omode != O_RDONLY){
  1048d8:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  1048dc:	85 c0                	test   %eax,%eax
  1048de:	0f 84 57 ff ff ff    	je     10483b <sys_open+0x6b>
      iunlockput(ip);
  1048e4:	89 34 24             	mov    %esi,(%esp)
  1048e7:	e8 04 d0 ff ff       	call   1018f0 <iunlockput>
      return -1;
  1048ec:	eb 87                	jmp    104875 <sys_open+0xa5>
  1048ee:	66 90                	xchg   %ax,%ax

001048f0 <sys_mkdir>:
  return fd;
}

int
sys_mkdir(void)
{
  1048f0:	53                   	push   %ebx
  char *path;
  struct inode *ip;

  if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0)
    return -1;
  1048f1:	bb ff ff ff ff       	mov    $0xffffffff,%ebx
  return fd;
}

int
sys_mkdir(void)
{
  1048f6:	83 ec 28             	sub    $0x28,%esp
  char *path;
  struct inode *ip;

  if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0)
  1048f9:	8d 44 24 1c          	lea    0x1c(%esp),%eax
  1048fd:	89 44 24 04          	mov    %eax,0x4(%esp)
  104901:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  104908:	e8 e3 f6 ff ff       	call   103ff0 <argstr>
  10490d:	85 c0                	test   %eax,%eax
  10490f:	78 25                	js     104936 <sys_mkdir+0x46>
  104911:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  104915:	31 c9                	xor    %ecx,%ecx
  104917:	ba 01 00 00 00       	mov    $0x1,%edx
  10491c:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  104923:	e8 a8 f7 ff ff       	call   1040d0 <create>
  104928:	85 c0                	test   %eax,%eax
  10492a:	74 0a                	je     104936 <sys_mkdir+0x46>
    return -1;
  iunlockput(ip);
  10492c:	89 04 24             	mov    %eax,(%esp)
  return 0;
  10492f:	31 db                	xor    %ebx,%ebx
  char *path;
  struct inode *ip;

  if(argstr(0, &path) < 0 || (ip = create(path, T_DIR, 0, 0)) == 0)
    return -1;
  iunlockput(ip);
  104931:	e8 ba cf ff ff       	call   1018f0 <iunlockput>
  return 0;
}
  104936:	83 c4 28             	add    $0x28,%esp
  104939:	89 d8                	mov    %ebx,%eax
  10493b:	5b                   	pop    %ebx
  10493c:	c3                   	ret    
  10493d:	8d 76 00             	lea    0x0(%esi),%esi

00104940 <sys_mknod>:

int
sys_mknod(void)
{
  104940:	53                   	push   %ebx
  
  if((len=argstr(0, &path)) < 0 ||
     argint(1, &major) < 0 ||
     argint(2, &minor) < 0 ||
     (ip = create(path, T_DEV, major, minor)) == 0)
    return -1;
  104941:	bb ff ff ff ff       	mov    $0xffffffff,%ebx
  return 0;
}

int
sys_mknod(void)
{
  104946:	83 ec 28             	sub    $0x28,%esp
  struct inode *ip;
  char *path;
  int len;
  int major, minor;
  
  if((len=argstr(0, &path)) < 0 ||
  104949:	8d 44 24 14          	lea    0x14(%esp),%eax
  10494d:	89 44 24 04          	mov    %eax,0x4(%esp)
  104951:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  104958:	e8 93 f6 ff ff       	call   103ff0 <argstr>
  10495d:	85 c0                	test   %eax,%eax
  10495f:	78 59                	js     1049ba <sys_mknod+0x7a>
     argint(1, &major) < 0 ||
  104961:	8d 44 24 18          	lea    0x18(%esp),%eax
  104965:	89 44 24 04          	mov    %eax,0x4(%esp)
  104969:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  104970:	e8 cb f5 ff ff       	call   103f40 <argint>
  struct inode *ip;
  char *path;
  int len;
  int major, minor;
  
  if((len=argstr(0, &path)) < 0 ||
  104975:	85 c0                	test   %eax,%eax
  104977:	78 41                	js     1049ba <sys_mknod+0x7a>
     argint(1, &major) < 0 ||
     argint(2, &minor) < 0 ||
  104979:	8d 44 24 1c          	lea    0x1c(%esp),%eax
  10497d:	89 44 24 04          	mov    %eax,0x4(%esp)
  104981:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
  104988:	e8 b3 f5 ff ff       	call   103f40 <argint>
  char *path;
  int len;
  int major, minor;
  
  if((len=argstr(0, &path)) < 0 ||
     argint(1, &major) < 0 ||
  10498d:	85 c0                	test   %eax,%eax
  10498f:	78 29                	js     1049ba <sys_mknod+0x7a>
     argint(2, &minor) < 0 ||
     (ip = create(path, T_DEV, major, minor)) == 0)
  104991:	0f bf 44 24 1c       	movswl 0x1c(%esp),%eax
  int len;
  int major, minor;
  
  if((len=argstr(0, &path)) < 0 ||
     argint(1, &major) < 0 ||
     argint(2, &minor) < 0 ||
  104996:	ba 03 00 00 00       	mov    $0x3,%edx
     (ip = create(path, T_DEV, major, minor)) == 0)
  10499b:	0f bf 4c 24 18       	movswl 0x18(%esp),%ecx
  1049a0:	89 04 24             	mov    %eax,(%esp)
  int len;
  int major, minor;
  
  if((len=argstr(0, &path)) < 0 ||
     argint(1, &major) < 0 ||
     argint(2, &minor) < 0 ||
  1049a3:	8b 44 24 14          	mov    0x14(%esp),%eax
  1049a7:	e8 24 f7 ff ff       	call   1040d0 <create>
  1049ac:	85 c0                	test   %eax,%eax
  1049ae:	74 0a                	je     1049ba <sys_mknod+0x7a>
     (ip = create(path, T_DEV, major, minor)) == 0)
    return -1;
  iunlockput(ip);
  1049b0:	89 04 24             	mov    %eax,(%esp)
  return 0;
  1049b3:	31 db                	xor    %ebx,%ebx
  if((len=argstr(0, &path)) < 0 ||
     argint(1, &major) < 0 ||
     argint(2, &minor) < 0 ||
     (ip = create(path, T_DEV, major, minor)) == 0)
    return -1;
  iunlockput(ip);
  1049b5:	e8 36 cf ff ff       	call   1018f0 <iunlockput>
  return 0;
}
  1049ba:	83 c4 28             	add    $0x28,%esp
  1049bd:	89 d8                	mov    %ebx,%eax
  1049bf:	5b                   	pop    %ebx
  1049c0:	c3                   	ret    
  1049c1:	eb 0d                	jmp    1049d0 <sys_chdir>
  1049c3:	90                   	nop
  1049c4:	90                   	nop
  1049c5:	90                   	nop
  1049c6:	90                   	nop
  1049c7:	90                   	nop
  1049c8:	90                   	nop
  1049c9:	90                   	nop
  1049ca:	90                   	nop
  1049cb:	90                   	nop
  1049cc:	90                   	nop
  1049cd:	90                   	nop
  1049ce:	90                   	nop
  1049cf:	90                   	nop

001049d0 <sys_chdir>:

int
sys_chdir(void)
{
  1049d0:	56                   	push   %esi
  1049d1:	53                   	push   %ebx
  char *path;
  struct inode *ip;

  if(argstr(0, &path) < 0 || (ip = namei(path)) == 0)
    return -1;
  1049d2:	bb ff ff ff ff       	mov    $0xffffffff,%ebx
  return 0;
}

int
sys_chdir(void)
{
  1049d7:	83 ec 24             	sub    $0x24,%esp
  char *path;
  struct inode *ip;

  if(argstr(0, &path) < 0 || (ip = namei(path)) == 0)
  1049da:	8d 44 24 1c          	lea    0x1c(%esp),%eax
  1049de:	89 44 24 04          	mov    %eax,0x4(%esp)
  1049e2:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  1049e9:	e8 02 f6 ff ff       	call   103ff0 <argstr>
  1049ee:	85 c0                	test   %eax,%eax
  1049f0:	78 45                	js     104a37 <sys_chdir+0x67>
  1049f2:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  1049f6:	89 04 24             	mov    %eax,(%esp)
  1049f9:	e8 32 d5 ff ff       	call   101f30 <namei>
  1049fe:	85 c0                	test   %eax,%eax
  104a00:	89 c6                	mov    %eax,%esi
  104a02:	74 33                	je     104a37 <sys_chdir+0x67>
    return -1;
  ilock(ip);
  104a04:	89 04 24             	mov    %eax,(%esp)
  104a07:	e8 44 cc ff ff       	call   101650 <ilock>
  if(ip->type != T_DIR){
  104a0c:	66 83 7e 10 01       	cmpw   $0x1,0x10(%esi)
    iunlockput(ip);
  104a11:	89 34 24             	mov    %esi,(%esp)
  struct inode *ip;

  if(argstr(0, &path) < 0 || (ip = namei(path)) == 0)
    return -1;
  ilock(ip);
  if(ip->type != T_DIR){
  104a14:	75 2a                	jne    104a40 <sys_chdir+0x70>
    iunlockput(ip);
    return -1;
  }
  iunlock(ip);
  104a16:	e8 35 cd ff ff       	call   101750 <iunlock>
  iput(proc->cwd);
  104a1b:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  proc->cwd = ip;
  return 0;
  104a21:	31 db                	xor    %ebx,%ebx
  if(ip->type != T_DIR){
    iunlockput(ip);
    return -1;
  }
  iunlock(ip);
  iput(proc->cwd);
  104a23:	8b 40 68             	mov    0x68(%eax),%eax
  104a26:	89 04 24             	mov    %eax,(%esp)
  104a29:	e8 72 cd ff ff       	call   1017a0 <iput>
  proc->cwd = ip;
  104a2e:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  104a34:	89 70 68             	mov    %esi,0x68(%eax)
  return 0;
}
  104a37:	83 c4 24             	add    $0x24,%esp
  104a3a:	89 d8                	mov    %ebx,%eax
  104a3c:	5b                   	pop    %ebx
  104a3d:	5e                   	pop    %esi
  104a3e:	c3                   	ret    
  104a3f:	90                   	nop

  if(argstr(0, &path) < 0 || (ip = namei(path)) == 0)
    return -1;
  ilock(ip);
  if(ip->type != T_DIR){
    iunlockput(ip);
  104a40:	e8 ab ce ff ff       	call   1018f0 <iunlockput>
    return -1;
  104a45:	eb f0                	jmp    104a37 <sys_chdir+0x67>
  104a47:	89 f6                	mov    %esi,%esi
  104a49:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00104a50 <sys_exec>:
  return 0;
}

int
sys_exec(void)
{
  104a50:	55                   	push   %ebp
  104a51:	57                   	push   %edi
  104a52:	56                   	push   %esi
  104a53:	53                   	push   %ebx
  char *path, *argv[20];
  int i;
  uint uargv, uarg;

  if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0)
    return -1;
  104a54:	bb ff ff ff ff       	mov    $0xffffffff,%ebx
  return 0;
}

int
sys_exec(void)
{
  104a59:	83 ec 7c             	sub    $0x7c,%esp
  char *path, *argv[20];
  int i;
  uint uargv, uarg;

  if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0)
  104a5c:	8d 44 24 64          	lea    0x64(%esp),%eax
  104a60:	89 44 24 04          	mov    %eax,0x4(%esp)
  104a64:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  104a6b:	e8 80 f5 ff ff       	call   103ff0 <argstr>
  104a70:	85 c0                	test   %eax,%eax
  104a72:	0f 88 99 00 00 00    	js     104b11 <sys_exec+0xc1>
  104a78:	8d 44 24 68          	lea    0x68(%esp),%eax
  104a7c:	89 44 24 04          	mov    %eax,0x4(%esp)
  104a80:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  104a87:	e8 b4 f4 ff ff       	call   103f40 <argint>
  104a8c:	85 c0                	test   %eax,%eax
  104a8e:	0f 88 7d 00 00 00    	js     104b11 <sys_exec+0xc1>
    return -1;
  memset(argv, 0, sizeof(argv));
  104a94:	8d 7c 24 14          	lea    0x14(%esp),%edi
  for(i=0;; i++){
    if(i >= NELEM(argv))
  104a98:	31 f6                	xor    %esi,%esi
  int i;
  uint uargv, uarg;

  if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0)
    return -1;
  memset(argv, 0, sizeof(argv));
  104a9a:	c7 44 24 08 50 00 00 	movl   $0x50,0x8(%esp)
  104aa1:	00 
  for(i=0;; i++){
  104aa2:	31 db                	xor    %ebx,%ebx
  int i;
  uint uargv, uarg;

  if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0)
    return -1;
  memset(argv, 0, sizeof(argv));
  104aa4:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  104aab:	00 
  104aac:	8d 6c 24 6c          	lea    0x6c(%esp),%ebp
  104ab0:	89 3c 24             	mov    %edi,(%esp)
  104ab3:	e8 c8 f1 ff ff       	call   103c80 <memset>
  proc->cwd = ip;
  return 0;
}

int
sys_exec(void)
  104ab8:	8d 04 9d 00 00 00 00 	lea    0x0(,%ebx,4),%eax
    return -1;
  memset(argv, 0, sizeof(argv));
  for(i=0;; i++){
    if(i >= NELEM(argv))
      return -1;
    if(fetchint(proc, uargv+4*i, (int*)&uarg) < 0)
  104abf:	03 44 24 68          	add    0x68(%esp),%eax
  104ac3:	89 6c 24 08          	mov    %ebp,0x8(%esp)
  104ac7:	89 44 24 04          	mov    %eax,0x4(%esp)
  104acb:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  104ad1:	89 04 24             	mov    %eax,(%esp)
  104ad4:	e8 d7 f3 ff ff       	call   103eb0 <fetchint>
  104ad9:	85 c0                	test   %eax,%eax
  104adb:	78 2f                	js     104b0c <sys_exec+0xbc>
      return -1;
    if(uarg == 0){
  104add:	8b 44 24 6c          	mov    0x6c(%esp),%eax
  104ae1:	85 c0                	test   %eax,%eax
  104ae3:	74 3b                	je     104b20 <sys_exec+0xd0>
      argv[i] = 0;
      break;
    }
    if(fetchstr(proc, uarg, &argv[i]) < 0)
  104ae5:	89 44 24 04          	mov    %eax,0x4(%esp)
  104ae9:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  104aef:	8d 14 b7             	lea    (%edi,%esi,4),%edx
  104af2:	89 54 24 08          	mov    %edx,0x8(%esp)
  104af6:	89 04 24             	mov    %eax,(%esp)
  104af9:	e8 f2 f3 ff ff       	call   103ef0 <fetchstr>
  104afe:	85 c0                	test   %eax,%eax
  104b00:	78 0a                	js     104b0c <sys_exec+0xbc>
  uint uargv, uarg;

  if(argstr(0, &path) < 0 || argint(1, (int*)&uargv) < 0)
    return -1;
  memset(argv, 0, sizeof(argv));
  for(i=0;; i++){
  104b02:	83 c3 01             	add    $0x1,%ebx
    if(i >= NELEM(argv))
  104b05:	83 fb 14             	cmp    $0x14,%ebx
  104b08:	89 de                	mov    %ebx,%esi
  104b0a:	75 ac                	jne    104ab8 <sys_exec+0x68>
    if(uarg == 0){
      argv[i] = 0;
      break;
    }
    if(fetchstr(proc, uarg, &argv[i]) < 0)
      return -1;
  104b0c:	bb ff ff ff ff       	mov    $0xffffffff,%ebx
  }
  return exec(path, argv);
}
  104b11:	83 c4 7c             	add    $0x7c,%esp
  104b14:	89 d8                	mov    %ebx,%eax
  104b16:	5b                   	pop    %ebx
  104b17:	5e                   	pop    %esi
  104b18:	5f                   	pop    %edi
  104b19:	5d                   	pop    %ebp
  104b1a:	c3                   	ret    
  104b1b:	90                   	nop
  104b1c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
      break;
    }
    if(fetchstr(proc, uarg, &argv[i]) < 0)
      return -1;
  }
  return exec(path, argv);
  104b20:	8b 44 24 64          	mov    0x64(%esp),%eax
    if(i >= NELEM(argv))
      return -1;
    if(fetchint(proc, uargv+4*i, (int*)&uarg) < 0)
      return -1;
    if(uarg == 0){
      argv[i] = 0;
  104b24:	c7 44 9c 14 00 00 00 	movl   $0x0,0x14(%esp,%ebx,4)
  104b2b:	00 
      break;
    }
    if(fetchstr(proc, uarg, &argv[i]) < 0)
      return -1;
  }
  return exec(path, argv);
  104b2c:	89 7c 24 04          	mov    %edi,0x4(%esp)
  104b30:	89 04 24             	mov    %eax,(%esp)
  104b33:	e8 98 be ff ff       	call   1009d0 <exec>
}
  104b38:	83 c4 7c             	add    $0x7c,%esp
      break;
    }
    if(fetchstr(proc, uarg, &argv[i]) < 0)
      return -1;
  }
  return exec(path, argv);
  104b3b:	89 c3                	mov    %eax,%ebx
}
  104b3d:	89 d8                	mov    %ebx,%eax
  104b3f:	5b                   	pop    %ebx
  104b40:	5e                   	pop    %esi
  104b41:	5f                   	pop    %edi
  104b42:	5d                   	pop    %ebp
  104b43:	c3                   	ret    
  104b44:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  104b4a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00104b50 <sys_pipe>:

int
sys_pipe(void)
{
  104b50:	57                   	push   %edi
  104b51:	56                   	push   %esi
  104b52:	53                   	push   %ebx
  int *fd;
  struct file *rf, *wf;
  int fd0, fd1;

  if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
    return -1;
  104b53:	bb ff ff ff ff       	mov    $0xffffffff,%ebx
  return exec(path, argv);
}

int
sys_pipe(void)
{
  104b58:	83 ec 20             	sub    $0x20,%esp
  int *fd;
  struct file *rf, *wf;
  int fd0, fd1;

  if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
  104b5b:	8d 44 24 14          	lea    0x14(%esp),%eax
  104b5f:	c7 44 24 08 08 00 00 	movl   $0x8,0x8(%esp)
  104b66:	00 
  104b67:	89 44 24 04          	mov    %eax,0x4(%esp)
  104b6b:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  104b72:	e8 19 f4 ff ff       	call   103f90 <argptr>
  104b77:	85 c0                	test   %eax,%eax
  104b79:	78 7d                	js     104bf8 <sys_pipe+0xa8>
    return -1;
  if(pipealloc(&rf, &wf) < 0)
  104b7b:	8d 44 24 1c          	lea    0x1c(%esp),%eax
  104b7f:	89 44 24 04          	mov    %eax,0x4(%esp)
  104b83:	8d 44 24 18          	lea    0x18(%esp),%eax
  104b87:	89 04 24             	mov    %eax,(%esp)
  104b8a:	e8 41 e0 ff ff       	call   102bd0 <pipealloc>
  104b8f:	85 c0                	test   %eax,%eax
  104b91:	78 65                	js     104bf8 <sys_pipe+0xa8>
    return -1;
  fd0 = -1;
  if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
  104b93:	65 8b 0d 04 00 00 00 	mov    %gs:0x4,%ecx
static int
fdalloc(struct file *f)
{
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
  104b9a:	31 c0                	xor    %eax,%eax
  if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
    return -1;
  if(pipealloc(&rf, &wf) < 0)
    return -1;
  fd0 = -1;
  if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
  104b9c:	8b 5c 24 18          	mov    0x18(%esp),%ebx
fdalloc(struct file *f)
{
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
    if(proc->ofile[fd] == 0){
  104ba0:	8b 54 81 28          	mov    0x28(%ecx,%eax,4),%edx
  104ba4:	85 d2                	test   %edx,%edx
  104ba6:	74 10                	je     104bb8 <sys_pipe+0x68>
static int
fdalloc(struct file *f)
{
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
  104ba8:	83 c0 01             	add    $0x1,%eax
  104bab:	83 f8 10             	cmp    $0x10,%eax
  104bae:	74 2f                	je     104bdf <sys_pipe+0x8f>
    if(proc->ofile[fd] == 0){
  104bb0:	8b 54 81 28          	mov    0x28(%ecx,%eax,4),%edx
  104bb4:	85 d2                	test   %edx,%edx
  104bb6:	75 f0                	jne    104ba8 <sys_pipe+0x58>
      proc->ofile[fd] = f;
  104bb8:	8d 70 08             	lea    0x8(%eax),%esi
static int
fdalloc(struct file *f)
{
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
  104bbb:	31 d2                	xor    %edx,%edx
    if(proc->ofile[fd] == 0){
      proc->ofile[fd] = f;
  104bbd:	89 5c b1 08          	mov    %ebx,0x8(%ecx,%esi,4)
  if(argptr(0, (void*)&fd, 2*sizeof(fd[0])) < 0)
    return -1;
  if(pipealloc(&rf, &wf) < 0)
    return -1;
  fd0 = -1;
  if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
  104bc1:	8b 7c 24 1c          	mov    0x1c(%esp),%edi
  104bc5:	8d 76 00             	lea    0x0(%esi),%esi
fdalloc(struct file *f)
{
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
    if(proc->ofile[fd] == 0){
  104bc8:	83 7c 91 28 00       	cmpl   $0x0,0x28(%ecx,%edx,4)
  104bcd:	74 39                	je     104c08 <sys_pipe+0xb8>
static int
fdalloc(struct file *f)
{
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
  104bcf:	83 c2 01             	add    $0x1,%edx
  104bd2:	83 fa 10             	cmp    $0x10,%edx
  104bd5:	75 f1                	jne    104bc8 <sys_pipe+0x78>
  if(pipealloc(&rf, &wf) < 0)
    return -1;
  fd0 = -1;
  if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
    if(fd0 >= 0)
      proc->ofile[fd0] = 0;
  104bd7:	c7 44 b1 08 00 00 00 	movl   $0x0,0x8(%ecx,%esi,4)
  104bde:	00 
    fileclose(rf);
  104bdf:	89 1c 24             	mov    %ebx,(%esp)
    fileclose(wf);
    return -1;
  104be2:	bb ff ff ff ff       	mov    $0xffffffff,%ebx
    return -1;
  fd0 = -1;
  if((fd0 = fdalloc(rf)) < 0 || (fd1 = fdalloc(wf)) < 0){
    if(fd0 >= 0)
      proc->ofile[fd0] = 0;
    fileclose(rf);
  104be7:	e8 d4 c2 ff ff       	call   100ec0 <fileclose>
    fileclose(wf);
  104bec:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  104bf0:	89 04 24             	mov    %eax,(%esp)
  104bf3:	e8 c8 c2 ff ff       	call   100ec0 <fileclose>
    return -1;
  }
  fd[0] = fd0;
  fd[1] = fd1;
  return 0;
}
  104bf8:	83 c4 20             	add    $0x20,%esp
  104bfb:	89 d8                	mov    %ebx,%eax
  104bfd:	5b                   	pop    %ebx
  104bfe:	5e                   	pop    %esi
  104bff:	5f                   	pop    %edi
  104c00:	c3                   	ret    
  104c01:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
{
  int fd;

  for(fd = 0; fd < NOFILE; fd++){
    if(proc->ofile[fd] == 0){
      proc->ofile[fd] = f;
  104c08:	89 7c 91 28          	mov    %edi,0x28(%ecx,%edx,4)
      proc->ofile[fd0] = 0;
    fileclose(rf);
    fileclose(wf);
    return -1;
  }
  fd[0] = fd0;
  104c0c:	8b 4c 24 14          	mov    0x14(%esp),%ecx
  fd[1] = fd1;
  return 0;
  104c10:	31 db                	xor    %ebx,%ebx
      proc->ofile[fd0] = 0;
    fileclose(rf);
    fileclose(wf);
    return -1;
  }
  fd[0] = fd0;
  104c12:	89 01                	mov    %eax,(%ecx)
  fd[1] = fd1;
  104c14:	8b 44 24 14          	mov    0x14(%esp),%eax
  104c18:	89 50 04             	mov    %edx,0x4(%eax)
  return 0;
}
  104c1b:	83 c4 20             	add    $0x20,%esp
  104c1e:	89 d8                	mov    %ebx,%eax
  104c20:	5b                   	pop    %ebx
  104c21:	5e                   	pop    %esi
  104c22:	5f                   	pop    %edi
  104c23:	c3                   	ret    
  104c24:	90                   	nop
  104c25:	90                   	nop
  104c26:	90                   	nop
  104c27:	90                   	nop
  104c28:	90                   	nop
  104c29:	90                   	nop
  104c2a:	90                   	nop
  104c2b:	90                   	nop
  104c2c:	90                   	nop
  104c2d:	90                   	nop
  104c2e:	90                   	nop
  104c2f:	90                   	nop

00104c30 <sys_fork>:
#include "proc.h"

int
sys_fork(void)
{
  return fork();
  104c30:	e9 6b e8 ff ff       	jmp    1034a0 <fork>
  104c35:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  104c39:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00104c40 <sys_exit>:
}

int
sys_exit(void)
{
  104c40:	83 ec 0c             	sub    $0xc,%esp
  exit();
  104c43:	e8 68 ec ff ff       	call   1038b0 <exit>
  return 0;  // not reached
}
  104c48:	31 c0                	xor    %eax,%eax
  104c4a:	83 c4 0c             	add    $0xc,%esp
  104c4d:	c3                   	ret    
  104c4e:	66 90                	xchg   %ax,%ax

00104c50 <sys_wait>:

int
sys_wait(void)
{
  return wait();
  104c50:	e9 7b ed ff ff       	jmp    1039d0 <wait>
  104c55:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  104c59:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00104c60 <sys_kill>:
}

int
sys_kill(void)
{
  104c60:	83 ec 2c             	sub    $0x2c,%esp
  int pid;

  if(argint(0, &pid) < 0)
  104c63:	8d 44 24 1c          	lea    0x1c(%esp),%eax
  104c67:	89 44 24 04          	mov    %eax,0x4(%esp)
  104c6b:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  104c72:	e8 c9 f2 ff ff       	call   103f40 <argint>
  104c77:	89 c2                	mov    %eax,%edx
    return -1;
  104c79:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
int
sys_kill(void)
{
  int pid;

  if(argint(0, &pid) < 0)
  104c7e:	85 d2                	test   %edx,%edx
  104c80:	78 0c                	js     104c8e <sys_kill+0x2e>
    return -1;
  return kill(pid);
  104c82:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  104c86:	89 04 24             	mov    %eax,(%esp)
  104c89:	e8 92 eb ff ff       	call   103820 <kill>
}
  104c8e:	83 c4 2c             	add    $0x2c,%esp
  104c91:	c3                   	ret    
  104c92:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  104c99:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00104ca0 <sys_getpid>:

int
sys_getpid(void)
{
  return proc->pid;
  104ca0:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  104ca6:	8b 40 10             	mov    0x10(%eax),%eax
}
  104ca9:	c3                   	ret    
  104caa:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi

00104cb0 <sys_sbrk>:

int
sys_sbrk(void)
{
  104cb0:	53                   	push   %ebx
  104cb1:	83 ec 28             	sub    $0x28,%esp
  int addr;
  int n;

  if(argint(0, &n) < 0)
  104cb4:	8d 44 24 1c          	lea    0x1c(%esp),%eax
  104cb8:	89 44 24 04          	mov    %eax,0x4(%esp)
  104cbc:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  104cc3:	e8 78 f2 ff ff       	call   103f40 <argint>
  104cc8:	89 c2                	mov    %eax,%edx
    return -1;
  104cca:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
sys_sbrk(void)
{
  int addr;
  int n;

  if(argint(0, &n) < 0)
  104ccf:	85 d2                	test   %edx,%edx
  104cd1:	78 1a                	js     104ced <sys_sbrk+0x3d>
    return -1;
  addr = proc->sz;
  104cd3:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  104cd9:	8b 58 04             	mov    0x4(%eax),%ebx
  if(growproc(n) < 0)
  104cdc:	8b 44 24 1c          	mov    0x1c(%esp),%eax
  104ce0:	89 04 24             	mov    %eax,(%esp)
  104ce3:	e8 18 e7 ff ff       	call   103400 <growproc>
  int addr;
  int n;

  if(argint(0, &n) < 0)
    return -1;
  addr = proc->sz;
  104ce8:	c1 f8 1f             	sar    $0x1f,%eax
  104ceb:	09 d8                	or     %ebx,%eax
  if(growproc(n) < 0)
    return -1;
  return addr;
}
  104ced:	83 c4 28             	add    $0x28,%esp
  104cf0:	5b                   	pop    %ebx
  104cf1:	c3                   	ret    
  104cf2:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  104cf9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00104d00 <sys_sleep>:

int
sys_sleep(void)
{
  104d00:	53                   	push   %ebx
  104d01:	83 ec 28             	sub    $0x28,%esp
  int n, ticks0;
  
  if(argint(0, &n) < 0)
  104d04:	8d 44 24 1c          	lea    0x1c(%esp),%eax
  104d08:	89 44 24 04          	mov    %eax,0x4(%esp)
  104d0c:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  104d13:	e8 28 f2 ff ff       	call   103f40 <argint>
    return -1;
  104d18:	ba ff ff ff ff       	mov    $0xffffffff,%edx
int
sys_sleep(void)
{
  int n, ticks0;
  
  if(argint(0, &n) < 0)
  104d1d:	85 c0                	test   %eax,%eax
  104d1f:	78 5e                	js     104d7f <sys_sleep+0x7f>
    return -1;
  acquire(&tickslock);
  104d21:	c7 04 24 c0 df 10 00 	movl   $0x10dfc0,(%esp)
  104d28:	e8 43 ee ff ff       	call   103b70 <acquire>
  ticks0 = ticks;
  while(ticks - ticks0 < n){
  104d2d:	8b 54 24 1c          	mov    0x1c(%esp),%edx
  int n, ticks0;
  
  if(argint(0, &n) < 0)
    return -1;
  acquire(&tickslock);
  ticks0 = ticks;
  104d31:	8b 1d 00 e8 10 00    	mov    0x10e800,%ebx
  while(ticks - ticks0 < n){
  104d37:	85 d2                	test   %edx,%edx
  104d39:	7f 26                	jg     104d61 <sys_sleep+0x61>
  104d3b:	eb 4b                	jmp    104d88 <sys_sleep+0x88>
  104d3d:	8d 76 00             	lea    0x0(%esi),%esi
    if(proc->killed){
      release(&tickslock);
      return -1;
    }
    sleep(&ticks, &tickslock);
  104d40:	c7 44 24 04 c0 df 10 	movl   $0x10dfc0,0x4(%esp)
  104d47:	00 
  104d48:	c7 04 24 00 e8 10 00 	movl   $0x10e800,(%esp)
  104d4f:	e8 ac e9 ff ff       	call   103700 <sleep>
  
  if(argint(0, &n) < 0)
    return -1;
  acquire(&tickslock);
  ticks0 = ticks;
  while(ticks - ticks0 < n){
  104d54:	a1 00 e8 10 00       	mov    0x10e800,%eax
  104d59:	29 d8                	sub    %ebx,%eax
  104d5b:	3b 44 24 1c          	cmp    0x1c(%esp),%eax
  104d5f:	7d 27                	jge    104d88 <sys_sleep+0x88>
    if(proc->killed){
  104d61:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  104d67:	8b 40 24             	mov    0x24(%eax),%eax
  104d6a:	85 c0                	test   %eax,%eax
  104d6c:	74 d2                	je     104d40 <sys_sleep+0x40>
      release(&tickslock);
  104d6e:	c7 04 24 c0 df 10 00 	movl   $0x10dfc0,(%esp)
  104d75:	e8 b6 ee ff ff       	call   103c30 <release>
      return -1;
  104d7a:	ba ff ff ff ff       	mov    $0xffffffff,%edx
    }
    sleep(&ticks, &tickslock);
  }
  release(&tickslock);
  return 0;
}
  104d7f:	83 c4 28             	add    $0x28,%esp
  104d82:	89 d0                	mov    %edx,%eax
  104d84:	5b                   	pop    %ebx
  104d85:	c3                   	ret    
  104d86:	66 90                	xchg   %ax,%ax
      release(&tickslock);
      return -1;
    }
    sleep(&ticks, &tickslock);
  }
  release(&tickslock);
  104d88:	c7 04 24 c0 df 10 00 	movl   $0x10dfc0,(%esp)
  104d8f:	e8 9c ee ff ff       	call   103c30 <release>
  return 0;
  104d94:	31 d2                	xor    %edx,%edx
}
  104d96:	83 c4 28             	add    $0x28,%esp
  104d99:	89 d0                	mov    %edx,%eax
  104d9b:	5b                   	pop    %ebx
  104d9c:	c3                   	ret    
  104d9d:	90                   	nop
  104d9e:	90                   	nop
  104d9f:	90                   	nop

00104da0 <timerinit>:
#define TIMER_RATEGEN   0x04    // mode 2, rate generator
#define TIMER_16BIT     0x30    // r/w counter 16 bits, LSB first

void
timerinit(void)
{
  104da0:	83 ec 1c             	sub    $0x1c,%esp
}

static inline void
outb(ushort port, uchar data)
{
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
  104da3:	ba 43 00 00 00       	mov    $0x43,%edx
  104da8:	b8 34 00 00 00       	mov    $0x34,%eax
  104dad:	ee                   	out    %al,(%dx)
  104dae:	b8 9c ff ff ff       	mov    $0xffffff9c,%eax
  104db3:	b2 40                	mov    $0x40,%dl
  104db5:	ee                   	out    %al,(%dx)
  104db6:	b8 2e 00 00 00       	mov    $0x2e,%eax
  104dbb:	ee                   	out    %al,(%dx)
  // Interrupt 100 times/sec.
  outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
  outb(IO_TIMER1, TIMER_DIV(100) % 256);
  outb(IO_TIMER1, TIMER_DIV(100) / 256);
  picenable(IRQ_TIMER);
  104dbc:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  104dc3:	e8 28 dd ff ff       	call   102af0 <picenable>
}
  104dc8:	83 c4 1c             	add    $0x1c,%esp
  104dcb:	c3                   	ret    

00104dcc <alltraps>:
  104dcc:	1e                   	push   %ds
  104dcd:	06                   	push   %es
  104dce:	0f a0                	push   %fs
  104dd0:	0f a8                	push   %gs
  104dd2:	60                   	pusha  
  104dd3:	66 b8 10 00          	mov    $0x10,%ax
  104dd7:	8e d8                	mov    %eax,%ds
  104dd9:	8e c0                	mov    %eax,%es
  104ddb:	66 b8 18 00          	mov    $0x18,%ax
  104ddf:	8e e0                	mov    %eax,%fs
  104de1:	8e e8                	mov    %eax,%gs
  104de3:	54                   	push   %esp
  104de4:	e8 d7 00 00 00       	call   104ec0 <trap>
  104de9:	83 c4 04             	add    $0x4,%esp

00104dec <trapret>:
  104dec:	61                   	popa   
  104ded:	0f a9                	pop    %gs
  104def:	0f a1                	pop    %fs
  104df1:	07                   	pop    %es
  104df2:	1f                   	pop    %ds
  104df3:	83 c4 08             	add    $0x8,%esp
  104df6:	cf                   	iret   
  104df7:	90                   	nop
  104df8:	90                   	nop
  104df9:	90                   	nop
  104dfa:	90                   	nop
  104dfb:	90                   	nop
  104dfc:	90                   	nop
  104dfd:	90                   	nop
  104dfe:	90                   	nop
  104dff:	90                   	nop

00104e00 <tvinit>:
struct spinlock tickslock;
int ticks;

void
tvinit(void)
{
  104e00:	83 ec 1c             	sub    $0x1c,%esp
  int i;

  for(i = 0; i < 256; i++)
  104e03:	31 c0                	xor    %eax,%eax
  104e05:	ba 00 e0 10 00       	mov    $0x10e000,%edx
  104e0a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
  104e10:	8b 0c 85 08 83 10 00 	mov    0x108308(,%eax,4),%ecx
  104e17:	66 89 0c c5 00 e0 10 	mov    %cx,0x10e000(,%eax,8)
  104e1e:	00 
  104e1f:	c1 e9 10             	shr    $0x10,%ecx
  104e22:	66 c7 44 c2 02 08 00 	movw   $0x8,0x2(%edx,%eax,8)
  104e29:	c6 44 c2 04 00       	movb   $0x0,0x4(%edx,%eax,8)
  104e2e:	c6 44 c2 05 8e       	movb   $0x8e,0x5(%edx,%eax,8)
  104e33:	66 89 4c c2 06       	mov    %cx,0x6(%edx,%eax,8)
void
tvinit(void)
{
  int i;

  for(i = 0; i < 256; i++)
  104e38:	83 c0 01             	add    $0x1,%eax
  104e3b:	3d 00 01 00 00       	cmp    $0x100,%eax
  104e40:	75 ce                	jne    104e10 <tvinit+0x10>
    SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
  SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER);
  104e42:	a1 08 84 10 00       	mov    0x108408,%eax
  
  initlock(&tickslock, "time");
  104e47:	c7 44 24 04 b5 63 10 	movl   $0x1063b5,0x4(%esp)
  104e4e:	00 
  104e4f:	c7 04 24 c0 df 10 00 	movl   $0x10dfc0,(%esp)
{
  int i;

  for(i = 0; i < 256; i++)
    SETGATE(idt[i], 0, SEG_KCODE<<3, vectors[i], 0);
  SETGATE(idt[T_SYSCALL], 1, SEG_KCODE<<3, vectors[T_SYSCALL], DPL_USER);
  104e56:	66 c7 05 02 e2 10 00 	movw   $0x8,0x10e202
  104e5d:	08 00 
  104e5f:	66 a3 00 e2 10 00    	mov    %ax,0x10e200
  104e65:	c1 e8 10             	shr    $0x10,%eax
  104e68:	c6 05 04 e2 10 00 00 	movb   $0x0,0x10e204
  104e6f:	c6 05 05 e2 10 00 ef 	movb   $0xef,0x10e205
  104e76:	66 a3 06 e2 10 00    	mov    %ax,0x10e206
  
  initlock(&tickslock, "time");
  104e7c:	e8 2f ec ff ff       	call   103ab0 <initlock>
}
  104e81:	83 c4 1c             	add    $0x1c,%esp
  104e84:	c3                   	ret    
  104e85:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
  104e89:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00104e90 <idtinit>:

void
idtinit(void)
{
  104e90:	83 ec 10             	sub    $0x10,%esp
lidt(struct gatedesc *p, int size)
{
  volatile ushort pd[3];

  pd[0] = size-1;
  pd[1] = (uint)p;
  104e93:	b8 00 e0 10 00       	mov    $0x10e000,%eax
static inline void
lidt(struct gatedesc *p, int size)
{
  volatile ushort pd[3];

  pd[0] = size-1;
  104e98:	66 c7 44 24 0a ff 07 	movw   $0x7ff,0xa(%esp)
  pd[1] = (uint)p;
  104e9f:	66 89 44 24 0c       	mov    %ax,0xc(%esp)
  pd[2] = (uint)p >> 16;
  104ea4:	c1 e8 10             	shr    $0x10,%eax
  104ea7:	66 89 44 24 0e       	mov    %ax,0xe(%esp)

  asm volatile("lidt (%0)" : : "r" (pd));
  104eac:	8d 44 24 0a          	lea    0xa(%esp),%eax
  104eb0:	0f 01 18             	lidtl  (%eax)
  lidt(idt, sizeof(idt));
}
  104eb3:	83 c4 10             	add    $0x10,%esp
  104eb6:	c3                   	ret    
  104eb7:	89 f6                	mov    %esi,%esi
  104eb9:	8d bc 27 00 00 00 00 	lea    0x0(%edi,%eiz,1),%edi

00104ec0 <trap>:

void
trap(struct trapframe *tf)
{
  104ec0:	56                   	push   %esi
  104ec1:	53                   	push   %ebx
  104ec2:	83 ec 24             	sub    $0x24,%esp
  104ec5:	8b 5c 24 30          	mov    0x30(%esp),%ebx
  if(tf->trapno == T_SYSCALL){
  104ec9:	8b 43 30             	mov    0x30(%ebx),%eax
  104ecc:	83 f8 40             	cmp    $0x40,%eax
  104ecf:	0f 84 c3 00 00 00    	je     104f98 <trap+0xd8>
    if(proc->killed)
      exit();
    return;
  }

  switch(tf->trapno){
  104ed5:	8d 50 e0             	lea    -0x20(%eax),%edx
  104ed8:	83 fa 1f             	cmp    $0x1f,%edx
  104edb:	0f 86 af 00 00 00    	jbe    104f90 <trap+0xd0>
            cpu->id, tf->cs, tf->eip);
    lapiceoi();
    break;
   
  default:
    if(proc == 0 || (tf->cs&3) == 0){
  104ee1:	65 8b 15 04 00 00 00 	mov    %gs:0x4,%edx
  104ee8:	85 d2                	test   %edx,%edx
  104eea:	0f 84 d8 01 00 00    	je     1050c8 <trap+0x208>
  104ef0:	f6 43 3c 03          	testb  $0x3,0x3c(%ebx)
  104ef4:	0f 84 ce 01 00 00    	je     1050c8 <trap+0x208>
      cprintf("unexpected trap %d from cpu %d eip %x\n",
              tf->trapno, cpu->id, tf->eip);
      panic("trap");
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d eip %x -- kill proc\n",
  104efa:	8b 73 38             	mov    0x38(%ebx),%esi
  104efd:	8b 4a 10             	mov    0x10(%edx),%ecx
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip);
  104f00:	83 c2 6c             	add    $0x6c,%edx
      cprintf("unexpected trap %d from cpu %d eip %x\n",
              tf->trapno, cpu->id, tf->eip);
      panic("trap");
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d eip %x -- kill proc\n",
  104f03:	89 74 24 18          	mov    %esi,0x18(%esp)
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip);
  104f07:	65 8b 35 00 00 00 00 	mov    %gs:0x0,%esi
      cprintf("unexpected trap %d from cpu %d eip %x\n",
              tf->trapno, cpu->id, tf->eip);
      panic("trap");
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d eip %x -- kill proc\n",
  104f0e:	0f b6 36             	movzbl (%esi),%esi
  104f11:	89 74 24 14          	mov    %esi,0x14(%esp)
  104f15:	8b 73 34             	mov    0x34(%ebx),%esi
  104f18:	89 44 24 0c          	mov    %eax,0xc(%esp)
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip);
  104f1c:	89 54 24 08          	mov    %edx,0x8(%esp)
      cprintf("unexpected trap %d from cpu %d eip %x\n",
              tf->trapno, cpu->id, tf->eip);
      panic("trap");
    }
    // In user space, assume process misbehaved.
    cprintf("pid %d %s: trap %d err %d on cpu %d eip %x -- kill proc\n",
  104f20:	89 4c 24 04          	mov    %ecx,0x4(%esp)
  104f24:	89 74 24 10          	mov    %esi,0x10(%esp)
  104f28:	c7 04 24 0c 64 10 00 	movl   $0x10640c,(%esp)
  104f2f:	e8 1c b7 ff ff       	call   100650 <cprintf>
            proc->pid, proc->name, tf->trapno, tf->err, cpu->id, tf->eip);
    proc->killed = 1;
  104f34:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  104f3a:	c7 40 24 01 00 00 00 	movl   $0x1,0x24(%eax)
  104f41:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  }

  // Force process exit if it has been killed and is in user space.
  // (If it is still executing in the kernel, let it keep running 
  // until it gets to the regular system call return.)
  if(proc && proc->killed && (tf->cs&3) == DPL_USER)
  104f48:	85 c0                	test   %eax,%eax
  104f4a:	74 6e                	je     104fba <trap+0xfa>
  104f4c:	8b 50 24             	mov    0x24(%eax),%edx
  104f4f:	85 d2                	test   %edx,%edx
  104f51:	74 10                	je     104f63 <trap+0xa3>
  104f53:	0f b7 53 3c          	movzwl 0x3c(%ebx),%edx
  104f57:	83 e2 03             	and    $0x3,%edx
  104f5a:	83 fa 03             	cmp    $0x3,%edx
  104f5d:	0f 84 4d 01 00 00    	je     1050b0 <trap+0x1f0>
    exit();

  // Force process to give up CPU on clock tick.
  // If interrupts were on while locks held, would need to check nlock.
  if(proc && proc->state == RUNNING && tf->trapno == T_IRQ0+IRQ_TIMER)
  104f63:	83 78 0c 04          	cmpl   $0x4,0xc(%eax)
  104f67:	0f 84 1b 01 00 00    	je     105088 <trap+0x1c8>
    yield();

  // Check if the process has been killed since we yielded
  if(proc && proc->killed && (tf->cs&3) == DPL_USER)
  104f6d:	8b 40 24             	mov    0x24(%eax),%eax
  104f70:	85 c0                	test   %eax,%eax
  104f72:	74 46                	je     104fba <trap+0xfa>
  104f74:	0f b7 43 3c          	movzwl 0x3c(%ebx),%eax
  104f78:	83 e0 03             	and    $0x3,%eax
  104f7b:	83 f8 03             	cmp    $0x3,%eax
  104f7e:	75 3a                	jne    104fba <trap+0xfa>
    exit();
}
  104f80:	83 c4 24             	add    $0x24,%esp
  104f83:	5b                   	pop    %ebx
  104f84:	5e                   	pop    %esi
  if(proc && proc->state == RUNNING && tf->trapno == T_IRQ0+IRQ_TIMER)
    yield();

  // Check if the process has been killed since we yielded
  if(proc && proc->killed && (tf->cs&3) == DPL_USER)
    exit();
  104f85:	e9 26 e9 ff ff       	jmp    1038b0 <exit>
  104f8a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    if(proc->killed)
      exit();
    return;
  }

  switch(tf->trapno){
  104f90:	ff 24 95 48 64 10 00 	jmp    *0x106448(,%edx,4)
  104f97:	90                   	nop

void
trap(struct trapframe *tf)
{
  if(tf->trapno == T_SYSCALL){
    if(proc->killed)
  104f98:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  104f9e:	8b 70 24             	mov    0x24(%eax),%esi
  104fa1:	85 f6                	test   %esi,%esi
  104fa3:	75 1b                	jne    104fc0 <trap+0x100>
      exit();
    proc->tf = tf;
  104fa5:	89 58 18             	mov    %ebx,0x18(%eax)
    syscall();
  104fa8:	e8 b3 f0 ff ff       	call   104060 <syscall>
    if(proc->killed)
  104fad:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  104fb3:	8b 48 24             	mov    0x24(%eax),%ecx
  104fb6:	85 c9                	test   %ecx,%ecx
  104fb8:	75 c6                	jne    104f80 <trap+0xc0>
    yield();

  // Check if the process has been killed since we yielded
  if(proc && proc->killed && (tf->cs&3) == DPL_USER)
    exit();
}
  104fba:	83 c4 24             	add    $0x24,%esp
  104fbd:	5b                   	pop    %ebx
  104fbe:	5e                   	pop    %esi
  104fbf:	c3                   	ret    
void
trap(struct trapframe *tf)
{
  if(tf->trapno == T_SYSCALL){
    if(proc->killed)
      exit();
  104fc0:	e8 eb e8 ff ff       	call   1038b0 <exit>
  104fc5:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  104fcb:	eb d8                	jmp    104fa5 <trap+0xe5>
  104fcd:	8d 76 00             	lea    0x0(%esi),%esi
    uartintr();
    lapiceoi();
    break;
  case T_IRQ0 + 7:
  case T_IRQ0 + IRQ_SPURIOUS:
    cprintf("cpu%d: spurious interrupt at %x:%x\n",
  104fd0:	8b 43 38             	mov    0x38(%ebx),%eax
  104fd3:	89 44 24 0c          	mov    %eax,0xc(%esp)
  104fd7:	0f b7 43 3c          	movzwl 0x3c(%ebx),%eax
  104fdb:	89 44 24 08          	mov    %eax,0x8(%esp)
            cpu->id, tf->cs, tf->eip);
  104fdf:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
    uartintr();
    lapiceoi();
    break;
  case T_IRQ0 + 7:
  case T_IRQ0 + IRQ_SPURIOUS:
    cprintf("cpu%d: spurious interrupt at %x:%x\n",
  104fe5:	0f b6 00             	movzbl (%eax),%eax
  104fe8:	c7 04 24 c0 63 10 00 	movl   $0x1063c0,(%esp)
  104fef:	89 44 24 04          	mov    %eax,0x4(%esp)
  104ff3:	e8 58 b6 ff ff       	call   100650 <cprintf>
            cpu->id, tf->cs, tf->eip);
    lapiceoi();
  104ff8:	e8 43 d7 ff ff       	call   102740 <lapiceoi>
  104ffd:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
    break;
  105003:	e9 40 ff ff ff       	jmp    104f48 <trap+0x88>
  case T_IRQ0 + IRQ_KBD:
    kbdintr();
    lapiceoi();
    break;
  case T_IRQ0 + IRQ_COM1:
    uartintr();
  105008:	e8 23 02 00 00       	call   105230 <uartintr>
    lapiceoi();
  10500d:	e8 2e d7 ff ff       	call   102740 <lapiceoi>
  105012:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
    break;
  105018:	e9 2b ff ff ff       	jmp    104f48 <trap+0x88>
  10501d:	8d 76 00             	lea    0x0(%esi),%esi
      release(&tickslock);
    }
    lapiceoi();
    break;
  case T_IRQ0 + IRQ_IDE:
    ideintr();
  105020:	e8 8b d0 ff ff       	call   1020b0 <ideintr>
    lapiceoi();
  105025:	e8 16 d7 ff ff       	call   102740 <lapiceoi>
  10502a:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
    break;
  105030:	e9 13 ff ff ff       	jmp    104f48 <trap+0x88>
  105035:	8d 76 00             	lea    0x0(%esi),%esi
  case T_IRQ0 + IRQ_KBD:
    kbdintr();
  105038:	e8 a3 d5 ff ff       	call   1025e0 <kbdintr>
    lapiceoi();
  10503d:	e8 fe d6 ff ff       	call   102740 <lapiceoi>
  105042:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
    break;
  105048:	e9 fb fe ff ff       	jmp    104f48 <trap+0x88>
  10504d:	8d 76 00             	lea    0x0(%esi),%esi
    return;
  }

  switch(tf->trapno){
  case T_IRQ0 + IRQ_TIMER:
    if(cpu->id == 0){
  105050:	65 a1 00 00 00 00    	mov    %gs:0x0,%eax
  105056:	80 38 00             	cmpb   $0x0,(%eax)
  105059:	75 ca                	jne    105025 <trap+0x165>
      acquire(&tickslock);
  10505b:	c7 04 24 c0 df 10 00 	movl   $0x10dfc0,(%esp)
  105062:	e8 09 eb ff ff       	call   103b70 <acquire>
      ticks++;
  105067:	83 05 00 e8 10 00 01 	addl   $0x1,0x10e800
      wakeup(&ticks);
  10506e:	c7 04 24 00 e8 10 00 	movl   $0x10e800,(%esp)
  105075:	e8 46 e7 ff ff       	call   1037c0 <wakeup>
      release(&tickslock);
  10507a:	c7 04 24 c0 df 10 00 	movl   $0x10dfc0,(%esp)
  105081:	e8 aa eb ff ff       	call   103c30 <release>
  105086:	eb 9d                	jmp    105025 <trap+0x165>
  if(proc && proc->killed && (tf->cs&3) == DPL_USER)
    exit();

  // Force process to give up CPU on clock tick.
  // If interrupts were on while locks held, would need to check nlock.
  if(proc && proc->state == RUNNING && tf->trapno == T_IRQ0+IRQ_TIMER)
  105088:	83 7b 30 20          	cmpl   $0x20,0x30(%ebx)
  10508c:	0f 85 db fe ff ff    	jne    104f6d <trap+0xad>
    yield();
  105092:	e8 29 e6 ff ff       	call   1036c0 <yield>

  // Check if the process has been killed since we yielded
  if(proc && proc->killed && (tf->cs&3) == DPL_USER)
  105097:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  10509d:	85 c0                	test   %eax,%eax
  10509f:	0f 85 c8 fe ff ff    	jne    104f6d <trap+0xad>
  1050a5:	e9 10 ff ff ff       	jmp    104fba <trap+0xfa>
  1050aa:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi

  // Force process exit if it has been killed and is in user space.
  // (If it is still executing in the kernel, let it keep running 
  // until it gets to the regular system call return.)
  if(proc && proc->killed && (tf->cs&3) == DPL_USER)
    exit();
  1050b0:	e8 fb e7 ff ff       	call   1038b0 <exit>

  // Force process to give up CPU on clock tick.
  // If interrupts were on while locks held, would need to check nlock.
  if(proc && proc->state == RUNNING && tf->trapno == T_IRQ0+IRQ_TIMER)
  1050b5:	65 a1 04 00 00 00    	mov    %gs:0x4,%eax
  1050bb:	85 c0                	test   %eax,%eax
  1050bd:	0f 85 a0 fe ff ff    	jne    104f63 <trap+0xa3>
  1050c3:	e9 f2 fe ff ff       	jmp    104fba <trap+0xfa>
    break;
   
  default:
    if(proc == 0 || (tf->cs&3) == 0){
      // In kernel, it must be our mistake.
      cprintf("unexpected trap %d from cpu %d eip %x\n",
  1050c8:	8b 53 38             	mov    0x38(%ebx),%edx
  1050cb:	89 54 24 0c          	mov    %edx,0xc(%esp)
              tf->trapno, cpu->id, tf->eip);
  1050cf:	65 8b 15 00 00 00 00 	mov    %gs:0x0,%edx
    break;
   
  default:
    if(proc == 0 || (tf->cs&3) == 0){
      // In kernel, it must be our mistake.
      cprintf("unexpected trap %d from cpu %d eip %x\n",
  1050d6:	0f b6 12             	movzbl (%edx),%edx
  1050d9:	89 44 24 04          	mov    %eax,0x4(%esp)
  1050dd:	c7 04 24 e4 63 10 00 	movl   $0x1063e4,(%esp)
  1050e4:	89 54 24 08          	mov    %edx,0x8(%esp)
  1050e8:	e8 63 b5 ff ff       	call   100650 <cprintf>
              tf->trapno, cpu->id, tf->eip);
      panic("trap");
  1050ed:	c7 04 24 ba 63 10 00 	movl   $0x1063ba,(%esp)
  1050f4:	e8 a7 b6 ff ff       	call   1007a0 <panic>
  1050f9:	90                   	nop
  1050fa:	90                   	nop
  1050fb:	90                   	nop
  1050fc:	90                   	nop
  1050fd:	90                   	nop
  1050fe:	90                   	nop
  1050ff:	90                   	nop

00105100 <uartgetc>:
}

static int
uartgetc(void)
{
  if(!uart)
  105100:	a1 2c 88 10 00       	mov    0x10882c,%eax
    return -1;
  105105:	b9 ff ff ff ff       	mov    $0xffffffff,%ecx
}

static int
uartgetc(void)
{
  if(!uart)
  10510a:	85 c0                	test   %eax,%eax
  10510c:	74 10                	je     10511e <uartgetc+0x1e>
static inline uchar
inb(ushort port)
{
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
  10510e:	ba fd 03 00 00       	mov    $0x3fd,%edx
  105113:	ec                   	in     (%dx),%al
    return -1;
  if(!(inb(COM1+5) & 0x01))
  105114:	a8 01                	test   $0x1,%al
  105116:	74 06                	je     10511e <uartgetc+0x1e>
  105118:	b2 f8                	mov    $0xf8,%dl
  10511a:	ec                   	in     (%dx),%al
    return -1;
  return inb(COM1+0);
  10511b:	0f b6 c8             	movzbl %al,%ecx
}
  10511e:	89 c8                	mov    %ecx,%eax
  105120:	c3                   	ret    
  105121:	eb 0d                	jmp    105130 <uartputc>
  105123:	90                   	nop
  105124:	90                   	nop
  105125:	90                   	nop
  105126:	90                   	nop
  105127:	90                   	nop
  105128:	90                   	nop
  105129:	90                   	nop
  10512a:	90                   	nop
  10512b:	90                   	nop
  10512c:	90                   	nop
  10512d:	90                   	nop
  10512e:	90                   	nop
  10512f:	90                   	nop

00105130 <uartputc>:
    uartputc(*p);
}

void
uartputc(int c)
{
  105130:	56                   	push   %esi
  105131:	be fd 03 00 00       	mov    $0x3fd,%esi
  105136:	53                   	push   %ebx
  int i;

  if(!uart)
  105137:	bb 80 00 00 00       	mov    $0x80,%ebx
    uartputc(*p);
}

void
uartputc(int c)
{
  10513c:	83 ec 14             	sub    $0x14,%esp
  int i;

  if(!uart)
  10513f:	8b 15 2c 88 10 00    	mov    0x10882c,%edx
  105145:	85 d2                	test   %edx,%edx
  105147:	75 18                	jne    105161 <uartputc+0x31>
  105149:	eb 27                	jmp    105172 <uartputc+0x42>
  10514b:	90                   	nop
  10514c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    return;
  for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
    microdelay(10);
  105150:	c7 04 24 0a 00 00 00 	movl   $0xa,(%esp)
  105157:	e8 04 d6 ff ff       	call   102760 <microdelay>
{
  int i;

  if(!uart)
    return;
  for(i = 0; i < 128 && !(inb(COM1+5) & 0x20); i++)
  10515c:	83 eb 01             	sub    $0x1,%ebx
  10515f:	74 07                	je     105168 <uartputc+0x38>
  105161:	89 f2                	mov    %esi,%edx
  105163:	ec                   	in     (%dx),%al
  105164:	a8 20                	test   $0x20,%al
  105166:	74 e8                	je     105150 <uartputc+0x20>
}

static inline void
outb(ushort port, uchar data)
{
  asm volatile("out %0,%1" : : "a" (data), "d" (port));
  105168:	ba f8 03 00 00       	mov    $0x3f8,%edx
  10516d:	8b 44 24 20          	mov    0x20(%esp),%eax
  105171:	ee                   	out    %al,(%dx)
    microdelay(10);
  outb(COM1+0, c);
}
  105172:	83 c4 14             	add    $0x14,%esp
  105175:	5b                   	pop    %ebx
  105176:	5e                   	pop    %esi
  105177:	c3                   	ret    
  105178:	90                   	nop
  105179:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi

00105180 <uartinit>:

static int uart;    // is there a uart?

void
uartinit(void)
{
  105180:	55                   	push   %ebp
  105181:	31 c9                	xor    %ecx,%ecx
  105183:	57                   	push   %edi
  105184:	bf fa 03 00 00       	mov    $0x3fa,%edi
  105189:	56                   	push   %esi
  10518a:	89 c8                	mov    %ecx,%eax
  10518c:	53                   	push   %ebx
  10518d:	89 fa                	mov    %edi,%edx
  10518f:	83 ec 1c             	sub    $0x1c,%esp
  105192:	ee                   	out    %al,(%dx)
  105193:	be fb 03 00 00       	mov    $0x3fb,%esi
  105198:	b8 80 ff ff ff       	mov    $0xffffff80,%eax
  10519d:	89 f2                	mov    %esi,%edx
  10519f:	ee                   	out    %al,(%dx)
  1051a0:	bd f8 03 00 00       	mov    $0x3f8,%ebp
  1051a5:	b8 0c 00 00 00       	mov    $0xc,%eax
  1051aa:	89 ea                	mov    %ebp,%edx
  1051ac:	ee                   	out    %al,(%dx)
  1051ad:	bb f9 03 00 00       	mov    $0x3f9,%ebx
  1051b2:	89 c8                	mov    %ecx,%eax
  1051b4:	89 da                	mov    %ebx,%edx
  1051b6:	ee                   	out    %al,(%dx)
  1051b7:	b8 03 00 00 00       	mov    $0x3,%eax
  1051bc:	89 f2                	mov    %esi,%edx
  1051be:	ee                   	out    %al,(%dx)
  1051bf:	b2 fc                	mov    $0xfc,%dl
  1051c1:	89 c8                	mov    %ecx,%eax
  1051c3:	ee                   	out    %al,(%dx)
  1051c4:	b8 01 00 00 00       	mov    $0x1,%eax
  1051c9:	89 da                	mov    %ebx,%edx
  1051cb:	ee                   	out    %al,(%dx)
static inline uchar
inb(ushort port)
{
  uchar data;

  asm volatile("in %1,%0" : "=a" (data) : "d" (port));
  1051cc:	b2 fd                	mov    $0xfd,%dl
  1051ce:	ec                   	in     (%dx),%al
  outb(COM1+3, 0x03);    // Lock divisor, 8 data bits.
  outb(COM1+4, 0);
  outb(COM1+1, 0x01);    // Enable receive interrupts.

  // If status is 0xFF, no serial port.
  if(inb(COM1+5) == 0xFF)
  1051cf:	3c ff                	cmp    $0xff,%al
  1051d1:	74 52                	je     105225 <uartinit+0xa5>
    return;
  uart = 1;
  1051d3:	c7 05 2c 88 10 00 01 	movl   $0x1,0x10882c
  1051da:	00 00 00 
  1051dd:	89 fa                	mov    %edi,%edx
  1051df:	ec                   	in     (%dx),%al
  1051e0:	89 ea                	mov    %ebp,%edx
  1051e2:	ec                   	in     (%dx),%al
  inb(COM1+0);
  picenable(IRQ_COM1);
  ioapicenable(IRQ_COM1, 0);
  
  // Announce that we're here.
  for(p="xv6...\n"; *p; p++)
  1051e3:	bb c8 64 10 00       	mov    $0x1064c8,%ebx

  // Acknowledge pre-existing interrupt conditions;
  // enable interrupts.
  inb(COM1+2);
  inb(COM1+0);
  picenable(IRQ_COM1);
  1051e8:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
  1051ef:	e8 fc d8 ff ff       	call   102af0 <picenable>
  ioapicenable(IRQ_COM1, 0);
  1051f4:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  1051fb:	00 
  1051fc:	c7 04 24 04 00 00 00 	movl   $0x4,(%esp)
  105203:	e8 c8 d0 ff ff       	call   1022d0 <ioapicenable>
  
  // Announce that we're here.
  for(p="xv6...\n"; *p; p++)
  105208:	b8 78 00 00 00       	mov    $0x78,%eax
  10520d:	8d 76 00             	lea    0x0(%esi),%esi
    uartputc(*p);
  105210:	0f be c0             	movsbl %al,%eax
  inb(COM1+0);
  picenable(IRQ_COM1);
  ioapicenable(IRQ_COM1, 0);
  
  // Announce that we're here.
  for(p="xv6...\n"; *p; p++)
  105213:	83 c3 01             	add    $0x1,%ebx
    uartputc(*p);
  105216:	89 04 24             	mov    %eax,(%esp)
  105219:	e8 12 ff ff ff       	call   105130 <uartputc>
  inb(COM1+0);
  picenable(IRQ_COM1);
  ioapicenable(IRQ_COM1, 0);
  
  // Announce that we're here.
  for(p="xv6...\n"; *p; p++)
  10521e:	0f b6 03             	movzbl (%ebx),%eax
  105221:	84 c0                	test   %al,%al
  105223:	75 eb                	jne    105210 <uartinit+0x90>
    uartputc(*p);
}
  105225:	83 c4 1c             	add    $0x1c,%esp
  105228:	5b                   	pop    %ebx
  105229:	5e                   	pop    %esi
  10522a:	5f                   	pop    %edi
  10522b:	5d                   	pop    %ebp
  10522c:	c3                   	ret    
  10522d:	8d 76 00             	lea    0x0(%esi),%esi

00105230 <uartintr>:
  return inb(COM1+0);
}

void
uartintr(void)
{
  105230:	83 ec 1c             	sub    $0x1c,%esp
  consoleintr(uartgetc);
  105233:	c7 04 24 00 51 10 00 	movl   $0x105100,(%esp)
  10523a:	e8 f1 b5 ff ff       	call   100830 <consoleintr>
}
  10523f:	83 c4 1c             	add    $0x1c,%esp
  105242:	c3                   	ret    
  105243:	90                   	nop

00105244 <vector0>:
  105244:	6a 00                	push   $0x0
  105246:	6a 00                	push   $0x0
  105248:	e9 7f fb ff ff       	jmp    104dcc <alltraps>

0010524d <vector1>:
  10524d:	6a 00                	push   $0x0
  10524f:	6a 01                	push   $0x1
  105251:	e9 76 fb ff ff       	jmp    104dcc <alltraps>

00105256 <vector2>:
  105256:	6a 00                	push   $0x0
  105258:	6a 02                	push   $0x2
  10525a:	e9 6d fb ff ff       	jmp    104dcc <alltraps>

0010525f <vector3>:
  10525f:	6a 00                	push   $0x0
  105261:	6a 03                	push   $0x3
  105263:	e9 64 fb ff ff       	jmp    104dcc <alltraps>

00105268 <vector4>:
  105268:	6a 00                	push   $0x0
  10526a:	6a 04                	push   $0x4
  10526c:	e9 5b fb ff ff       	jmp    104dcc <alltraps>

00105271 <vector5>:
  105271:	6a 00                	push   $0x0
  105273:	6a 05                	push   $0x5
  105275:	e9 52 fb ff ff       	jmp    104dcc <alltraps>

0010527a <vector6>:
  10527a:	6a 00                	push   $0x0
  10527c:	6a 06                	push   $0x6
  10527e:	e9 49 fb ff ff       	jmp    104dcc <alltraps>

00105283 <vector7>:
  105283:	6a 00                	push   $0x0
  105285:	6a 07                	push   $0x7
  105287:	e9 40 fb ff ff       	jmp    104dcc <alltraps>

0010528c <vector8>:
  10528c:	6a 08                	push   $0x8
  10528e:	e9 39 fb ff ff       	jmp    104dcc <alltraps>

00105293 <vector9>:
  105293:	6a 00                	push   $0x0
  105295:	6a 09                	push   $0x9
  105297:	e9 30 fb ff ff       	jmp    104dcc <alltraps>

0010529c <vector10>:
  10529c:	6a 0a                	push   $0xa
  10529e:	e9 29 fb ff ff       	jmp    104dcc <alltraps>

001052a3 <vector11>:
  1052a3:	6a 0b                	push   $0xb
  1052a5:	e9 22 fb ff ff       	jmp    104dcc <alltraps>

001052aa <vector12>:
  1052aa:	6a 0c                	push   $0xc
  1052ac:	e9 1b fb ff ff       	jmp    104dcc <alltraps>

001052b1 <vector13>:
  1052b1:	6a 0d                	push   $0xd
  1052b3:	e9 14 fb ff ff       	jmp    104dcc <alltraps>

001052b8 <vector14>:
  1052b8:	6a 0e                	push   $0xe
  1052ba:	e9 0d fb ff ff       	jmp    104dcc <alltraps>

001052bf <vector15>:
  1052bf:	6a 00                	push   $0x0
  1052c1:	6a 0f                	push   $0xf
  1052c3:	e9 04 fb ff ff       	jmp    104dcc <alltraps>

001052c8 <vector16>:
  1052c8:	6a 00                	push   $0x0
  1052ca:	6a 10                	push   $0x10
  1052cc:	e9 fb fa ff ff       	jmp    104dcc <alltraps>

001052d1 <vector17>:
  1052d1:	6a 11                	push   $0x11
  1052d3:	e9 f4 fa ff ff       	jmp    104dcc <alltraps>

001052d8 <vector18>:
  1052d8:	6a 00                	push   $0x0
  1052da:	6a 12                	push   $0x12
  1052dc:	e9 eb fa ff ff       	jmp    104dcc <alltraps>

001052e1 <vector19>:
  1052e1:	6a 00                	push   $0x0
  1052e3:	6a 13                	push   $0x13
  1052e5:	e9 e2 fa ff ff       	jmp    104dcc <alltraps>

001052ea <vector20>:
  1052ea:	6a 00                	push   $0x0
  1052ec:	6a 14                	push   $0x14
  1052ee:	e9 d9 fa ff ff       	jmp    104dcc <alltraps>

001052f3 <vector21>:
  1052f3:	6a 00                	push   $0x0
  1052f5:	6a 15                	push   $0x15
  1052f7:	e9 d0 fa ff ff       	jmp    104dcc <alltraps>

001052fc <vector22>:
  1052fc:	6a 00                	push   $0x0
  1052fe:	6a 16                	push   $0x16
  105300:	e9 c7 fa ff ff       	jmp    104dcc <alltraps>

00105305 <vector23>:
  105305:	6a 00                	push   $0x0
  105307:	6a 17                	push   $0x17
  105309:	e9 be fa ff ff       	jmp    104dcc <alltraps>

0010530e <vector24>:
  10530e:	6a 00                	push   $0x0
  105310:	6a 18                	push   $0x18
  105312:	e9 b5 fa ff ff       	jmp    104dcc <alltraps>

00105317 <vector25>:
  105317:	6a 00                	push   $0x0
  105319:	6a 19                	push   $0x19
  10531b:	e9 ac fa ff ff       	jmp    104dcc <alltraps>

00105320 <vector26>:
  105320:	6a 00                	push   $0x0
  105322:	6a 1a                	push   $0x1a
  105324:	e9 a3 fa ff ff       	jmp    104dcc <alltraps>

00105329 <vector27>:
  105329:	6a 00                	push   $0x0
  10532b:	6a 1b                	push   $0x1b
  10532d:	e9 9a fa ff ff       	jmp    104dcc <alltraps>

00105332 <vector28>:
  105332:	6a 00                	push   $0x0
  105334:	6a 1c                	push   $0x1c
  105336:	e9 91 fa ff ff       	jmp    104dcc <alltraps>

0010533b <vector29>:
  10533b:	6a 00                	push   $0x0
  10533d:	6a 1d                	push   $0x1d
  10533f:	e9 88 fa ff ff       	jmp    104dcc <alltraps>

00105344 <vector30>:
  105344:	6a 00                	push   $0x0
  105346:	6a 1e                	push   $0x1e
  105348:	e9 7f fa ff ff       	jmp    104dcc <alltraps>

0010534d <vector31>:
  10534d:	6a 00                	push   $0x0
  10534f:	6a 1f                	push   $0x1f
  105351:	e9 76 fa ff ff       	jmp    104dcc <alltraps>

00105356 <vector32>:
  105356:	6a 00                	push   $0x0
  105358:	6a 20                	push   $0x20
  10535a:	e9 6d fa ff ff       	jmp    104dcc <alltraps>

0010535f <vector33>:
  10535f:	6a 00                	push   $0x0
  105361:	6a 21                	push   $0x21
  105363:	e9 64 fa ff ff       	jmp    104dcc <alltraps>

00105368 <vector34>:
  105368:	6a 00                	push   $0x0
  10536a:	6a 22                	push   $0x22
  10536c:	e9 5b fa ff ff       	jmp    104dcc <alltraps>

00105371 <vector35>:
  105371:	6a 00                	push   $0x0
  105373:	6a 23                	push   $0x23
  105375:	e9 52 fa ff ff       	jmp    104dcc <alltraps>

0010537a <vector36>:
  10537a:	6a 00                	push   $0x0
  10537c:	6a 24                	push   $0x24
  10537e:	e9 49 fa ff ff       	jmp    104dcc <alltraps>

00105383 <vector37>:
  105383:	6a 00                	push   $0x0
  105385:	6a 25                	push   $0x25
  105387:	e9 40 fa ff ff       	jmp    104dcc <alltraps>

0010538c <vector38>:
  10538c:	6a 00                	push   $0x0
  10538e:	6a 26                	push   $0x26
  105390:	e9 37 fa ff ff       	jmp    104dcc <alltraps>

00105395 <vector39>:
  105395:	6a 00                	push   $0x0
  105397:	6a 27                	push   $0x27
  105399:	e9 2e fa ff ff       	jmp    104dcc <alltraps>

0010539e <vector40>:
  10539e:	6a 00                	push   $0x0
  1053a0:	6a 28                	push   $0x28
  1053a2:	e9 25 fa ff ff       	jmp    104dcc <alltraps>

001053a7 <vector41>:
  1053a7:	6a 00                	push   $0x0
  1053a9:	6a 29                	push   $0x29
  1053ab:	e9 1c fa ff ff       	jmp    104dcc <alltraps>

001053b0 <vector42>:
  1053b0:	6a 00                	push   $0x0
  1053b2:	6a 2a                	push   $0x2a
  1053b4:	e9 13 fa ff ff       	jmp    104dcc <alltraps>

001053b9 <vector43>:
  1053b9:	6a 00                	push   $0x0
  1053bb:	6a 2b                	push   $0x2b
  1053bd:	e9 0a fa ff ff       	jmp    104dcc <alltraps>

001053c2 <vector44>:
  1053c2:	6a 00                	push   $0x0
  1053c4:	6a 2c                	push   $0x2c
  1053c6:	e9 01 fa ff ff       	jmp    104dcc <alltraps>

001053cb <vector45>:
  1053cb:	6a 00                	push   $0x0
  1053cd:	6a 2d                	push   $0x2d
  1053cf:	e9 f8 f9 ff ff       	jmp    104dcc <alltraps>

001053d4 <vector46>:
  1053d4:	6a 00                	push   $0x0
  1053d6:	6a 2e                	push   $0x2e
  1053d8:	e9 ef f9 ff ff       	jmp    104dcc <alltraps>

001053dd <vector47>:
  1053dd:	6a 00                	push   $0x0
  1053df:	6a 2f                	push   $0x2f
  1053e1:	e9 e6 f9 ff ff       	jmp    104dcc <alltraps>

001053e6 <vector48>:
  1053e6:	6a 00                	push   $0x0
  1053e8:	6a 30                	push   $0x30
  1053ea:	e9 dd f9 ff ff       	jmp    104dcc <alltraps>

001053ef <vector49>:
  1053ef:	6a 00                	push   $0x0
  1053f1:	6a 31                	push   $0x31
  1053f3:	e9 d4 f9 ff ff       	jmp    104dcc <alltraps>

001053f8 <vector50>:
  1053f8:	6a 00                	push   $0x0
  1053fa:	6a 32                	push   $0x32
  1053fc:	e9 cb f9 ff ff       	jmp    104dcc <alltraps>

00105401 <vector51>:
  105401:	6a 00                	push   $0x0
  105403:	6a 33                	push   $0x33
  105405:	e9 c2 f9 ff ff       	jmp    104dcc <alltraps>

0010540a <vector52>:
  10540a:	6a 00                	push   $0x0
  10540c:	6a 34                	push   $0x34
  10540e:	e9 b9 f9 ff ff       	jmp    104dcc <alltraps>

00105413 <vector53>:
  105413:	6a 00                	push   $0x0
  105415:	6a 35                	push   $0x35
  105417:	e9 b0 f9 ff ff       	jmp    104dcc <alltraps>

0010541c <vector54>:
  10541c:	6a 00                	push   $0x0
  10541e:	6a 36                	push   $0x36
  105420:	e9 a7 f9 ff ff       	jmp    104dcc <alltraps>

00105425 <vector55>:
  105425:	6a 00                	push   $0x0
  105427:	6a 37                	push   $0x37
  105429:	e9 9e f9 ff ff       	jmp    104dcc <alltraps>

0010542e <vector56>:
  10542e:	6a 00                	push   $0x0
  105430:	6a 38                	push   $0x38
  105432:	e9 95 f9 ff ff       	jmp    104dcc <alltraps>

00105437 <vector57>:
  105437:	6a 00                	push   $0x0
  105439:	6a 39                	push   $0x39
  10543b:	e9 8c f9 ff ff       	jmp    104dcc <alltraps>

00105440 <vector58>:
  105440:	6a 00                	push   $0x0
  105442:	6a 3a                	push   $0x3a
  105444:	e9 83 f9 ff ff       	jmp    104dcc <alltraps>

00105449 <vector59>:
  105449:	6a 00                	push   $0x0
  10544b:	6a 3b                	push   $0x3b
  10544d:	e9 7a f9 ff ff       	jmp    104dcc <alltraps>

00105452 <vector60>:
  105452:	6a 00                	push   $0x0
  105454:	6a 3c                	push   $0x3c
  105456:	e9 71 f9 ff ff       	jmp    104dcc <alltraps>

0010545b <vector61>:
  10545b:	6a 00                	push   $0x0
  10545d:	6a 3d                	push   $0x3d
  10545f:	e9 68 f9 ff ff       	jmp    104dcc <alltraps>

00105464 <vector62>:
  105464:	6a 00                	push   $0x0
  105466:	6a 3e                	push   $0x3e
  105468:	e9 5f f9 ff ff       	jmp    104dcc <alltraps>

0010546d <vector63>:
  10546d:	6a 00                	push   $0x0
  10546f:	6a 3f                	push   $0x3f
  105471:	e9 56 f9 ff ff       	jmp    104dcc <alltraps>

00105476 <vector64>:
  105476:	6a 00                	push   $0x0
  105478:	6a 40                	push   $0x40
  10547a:	e9 4d f9 ff ff       	jmp    104dcc <alltraps>

0010547f <vector65>:
  10547f:	6a 00                	push   $0x0
  105481:	6a 41                	push   $0x41
  105483:	e9 44 f9 ff ff       	jmp    104dcc <alltraps>

00105488 <vector66>:
  105488:	6a 00                	push   $0x0
  10548a:	6a 42                	push   $0x42
  10548c:	e9 3b f9 ff ff       	jmp    104dcc <alltraps>

00105491 <vector67>:
  105491:	6a 00                	push   $0x0
  105493:	6a 43                	push   $0x43
  105495:	e9 32 f9 ff ff       	jmp    104dcc <alltraps>

0010549a <vector68>:
  10549a:	6a 00                	push   $0x0
  10549c:	6a 44                	push   $0x44
  10549e:	e9 29 f9 ff ff       	jmp    104dcc <alltraps>

001054a3 <vector69>:
  1054a3:	6a 00                	push   $0x0
  1054a5:	6a 45                	push   $0x45
  1054a7:	e9 20 f9 ff ff       	jmp    104dcc <alltraps>

001054ac <vector70>:
  1054ac:	6a 00                	push   $0x0
  1054ae:	6a 46                	push   $0x46
  1054b0:	e9 17 f9 ff ff       	jmp    104dcc <alltraps>

001054b5 <vector71>:
  1054b5:	6a 00                	push   $0x0
  1054b7:	6a 47                	push   $0x47
  1054b9:	e9 0e f9 ff ff       	jmp    104dcc <alltraps>

001054be <vector72>:
  1054be:	6a 00                	push   $0x0
  1054c0:	6a 48                	push   $0x48
  1054c2:	e9 05 f9 ff ff       	jmp    104dcc <alltraps>

001054c7 <vector73>:
  1054c7:	6a 00                	push   $0x0
  1054c9:	6a 49                	push   $0x49
  1054cb:	e9 fc f8 ff ff       	jmp    104dcc <alltraps>

001054d0 <vector74>:
  1054d0:	6a 00                	push   $0x0
  1054d2:	6a 4a                	push   $0x4a
  1054d4:	e9 f3 f8 ff ff       	jmp    104dcc <alltraps>

001054d9 <vector75>:
  1054d9:	6a 00                	push   $0x0
  1054db:	6a 4b                	push   $0x4b
  1054dd:	e9 ea f8 ff ff       	jmp    104dcc <alltraps>

001054e2 <vector76>:
  1054e2:	6a 00                	push   $0x0
  1054e4:	6a 4c                	push   $0x4c
  1054e6:	e9 e1 f8 ff ff       	jmp    104dcc <alltraps>

001054eb <vector77>:
  1054eb:	6a 00                	push   $0x0
  1054ed:	6a 4d                	push   $0x4d
  1054ef:	e9 d8 f8 ff ff       	jmp    104dcc <alltraps>

001054f4 <vector78>:
  1054f4:	6a 00                	push   $0x0
  1054f6:	6a 4e                	push   $0x4e
  1054f8:	e9 cf f8 ff ff       	jmp    104dcc <alltraps>

001054fd <vector79>:
  1054fd:	6a 00                	push   $0x0
  1054ff:	6a 4f                	push   $0x4f
  105501:	e9 c6 f8 ff ff       	jmp    104dcc <alltraps>

00105506 <vector80>:
  105506:	6a 00                	push   $0x0
  105508:	6a 50                	push   $0x50
  10550a:	e9 bd f8 ff ff       	jmp    104dcc <alltraps>

0010550f <vector81>:
  10550f:	6a 00                	push   $0x0
  105511:	6a 51                	push   $0x51
  105513:	e9 b4 f8 ff ff       	jmp    104dcc <alltraps>

00105518 <vector82>:
  105518:	6a 00                	push   $0x0
  10551a:	6a 52                	push   $0x52
  10551c:	e9 ab f8 ff ff       	jmp    104dcc <alltraps>

00105521 <vector83>:
  105521:	6a 00                	push   $0x0
  105523:	6a 53                	push   $0x53
  105525:	e9 a2 f8 ff ff       	jmp    104dcc <alltraps>

0010552a <vector84>:
  10552a:	6a 00                	push   $0x0
  10552c:	6a 54                	push   $0x54
  10552e:	e9 99 f8 ff ff       	jmp    104dcc <alltraps>

00105533 <vector85>:
  105533:	6a 00                	push   $0x0
  105535:	6a 55                	push   $0x55
  105537:	e9 90 f8 ff ff       	jmp    104dcc <alltraps>

0010553c <vector86>:
  10553c:	6a 00                	push   $0x0
  10553e:	6a 56                	push   $0x56
  105540:	e9 87 f8 ff ff       	jmp    104dcc <alltraps>

00105545 <vector87>:
  105545:	6a 00                	push   $0x0
  105547:	6a 57                	push   $0x57
  105549:	e9 7e f8 ff ff       	jmp    104dcc <alltraps>

0010554e <vector88>:
  10554e:	6a 00                	push   $0x0
  105550:	6a 58                	push   $0x58
  105552:	e9 75 f8 ff ff       	jmp    104dcc <alltraps>

00105557 <vector89>:
  105557:	6a 00                	push   $0x0
  105559:	6a 59                	push   $0x59
  10555b:	e9 6c f8 ff ff       	jmp    104dcc <alltraps>

00105560 <vector90>:
  105560:	6a 00                	push   $0x0
  105562:	6a 5a                	push   $0x5a
  105564:	e9 63 f8 ff ff       	jmp    104dcc <alltraps>

00105569 <vector91>:
  105569:	6a 00                	push   $0x0
  10556b:	6a 5b                	push   $0x5b
  10556d:	e9 5a f8 ff ff       	jmp    104dcc <alltraps>

00105572 <vector92>:
  105572:	6a 00                	push   $0x0
  105574:	6a 5c                	push   $0x5c
  105576:	e9 51 f8 ff ff       	jmp    104dcc <alltraps>

0010557b <vector93>:
  10557b:	6a 00                	push   $0x0
  10557d:	6a 5d                	push   $0x5d
  10557f:	e9 48 f8 ff ff       	jmp    104dcc <alltraps>

00105584 <vector94>:
  105584:	6a 00                	push   $0x0
  105586:	6a 5e                	push   $0x5e
  105588:	e9 3f f8 ff ff       	jmp    104dcc <alltraps>

0010558d <vector95>:
  10558d:	6a 00                	push   $0x0
  10558f:	6a 5f                	push   $0x5f
  105591:	e9 36 f8 ff ff       	jmp    104dcc <alltraps>

00105596 <vector96>:
  105596:	6a 00                	push   $0x0
  105598:	6a 60                	push   $0x60
  10559a:	e9 2d f8 ff ff       	jmp    104dcc <alltraps>

0010559f <vector97>:
  10559f:	6a 00                	push   $0x0
  1055a1:	6a 61                	push   $0x61
  1055a3:	e9 24 f8 ff ff       	jmp    104dcc <alltraps>

001055a8 <vector98>:
  1055a8:	6a 00                	push   $0x0
  1055aa:	6a 62                	push   $0x62
  1055ac:	e9 1b f8 ff ff       	jmp    104dcc <alltraps>

001055b1 <vector99>:
  1055b1:	6a 00                	push   $0x0
  1055b3:	6a 63                	push   $0x63
  1055b5:	e9 12 f8 ff ff       	jmp    104dcc <alltraps>

001055ba <vector100>:
  1055ba:	6a 00                	push   $0x0
  1055bc:	6a 64                	push   $0x64
  1055be:	e9 09 f8 ff ff       	jmp    104dcc <alltraps>

001055c3 <vector101>:
  1055c3:	6a 00                	push   $0x0
  1055c5:	6a 65                	push   $0x65
  1055c7:	e9 00 f8 ff ff       	jmp    104dcc <alltraps>

001055cc <vector102>:
  1055cc:	6a 00                	push   $0x0
  1055ce:	6a 66                	push   $0x66
  1055d0:	e9 f7 f7 ff ff       	jmp    104dcc <alltraps>

001055d5 <vector103>:
  1055d5:	6a 00                	push   $0x0
  1055d7:	6a 67                	push   $0x67
  1055d9:	e9 ee f7 ff ff       	jmp    104dcc <alltraps>

001055de <vector104>:
  1055de:	6a 00                	push   $0x0
  1055e0:	6a 68                	push   $0x68
  1055e2:	e9 e5 f7 ff ff       	jmp    104dcc <alltraps>

001055e7 <vector105>:
  1055e7:	6a 00                	push   $0x0
  1055e9:	6a 69                	push   $0x69
  1055eb:	e9 dc f7 ff ff       	jmp    104dcc <alltraps>

001055f0 <vector106>:
  1055f0:	6a 00                	push   $0x0
  1055f2:	6a 6a                	push   $0x6a
  1055f4:	e9 d3 f7 ff ff       	jmp    104dcc <alltraps>

001055f9 <vector107>:
  1055f9:	6a 00                	push   $0x0
  1055fb:	6a 6b                	push   $0x6b
  1055fd:	e9 ca f7 ff ff       	jmp    104dcc <alltraps>

00105602 <vector108>:
  105602:	6a 00                	push   $0x0
  105604:	6a 6c                	push   $0x6c
  105606:	e9 c1 f7 ff ff       	jmp    104dcc <alltraps>

0010560b <vector109>:
  10560b:	6a 00                	push   $0x0
  10560d:	6a 6d                	push   $0x6d
  10560f:	e9 b8 f7 ff ff       	jmp    104dcc <alltraps>

00105614 <vector110>:
  105614:	6a 00                	push   $0x0
  105616:	6a 6e                	push   $0x6e
  105618:	e9 af f7 ff ff       	jmp    104dcc <alltraps>

0010561d <vector111>:
  10561d:	6a 00                	push   $0x0
  10561f:	6a 6f                	push   $0x6f
  105621:	e9 a6 f7 ff ff       	jmp    104dcc <alltraps>

00105626 <vector112>:
  105626:	6a 00                	push   $0x0
  105628:	6a 70                	push   $0x70
  10562a:	e9 9d f7 ff ff       	jmp    104dcc <alltraps>

0010562f <vector113>:
  10562f:	6a 00                	push   $0x0
  105631:	6a 71                	push   $0x71
  105633:	e9 94 f7 ff ff       	jmp    104dcc <alltraps>

00105638 <vector114>:
  105638:	6a 00                	push   $0x0
  10563a:	6a 72                	push   $0x72
  10563c:	e9 8b f7 ff ff       	jmp    104dcc <alltraps>

00105641 <vector115>:
  105641:	6a 00                	push   $0x0
  105643:	6a 73                	push   $0x73
  105645:	e9 82 f7 ff ff       	jmp    104dcc <alltraps>

0010564a <vector116>:
  10564a:	6a 00                	push   $0x0
  10564c:	6a 74                	push   $0x74
  10564e:	e9 79 f7 ff ff       	jmp    104dcc <alltraps>

00105653 <vector117>:
  105653:	6a 00                	push   $0x0
  105655:	6a 75                	push   $0x75
  105657:	e9 70 f7 ff ff       	jmp    104dcc <alltraps>

0010565c <vector118>:
  10565c:	6a 00                	push   $0x0
  10565e:	6a 76                	push   $0x76
  105660:	e9 67 f7 ff ff       	jmp    104dcc <alltraps>

00105665 <vector119>:
  105665:	6a 00                	push   $0x0
  105667:	6a 77                	push   $0x77
  105669:	e9 5e f7 ff ff       	jmp    104dcc <alltraps>

0010566e <vector120>:
  10566e:	6a 00                	push   $0x0
  105670:	6a 78                	push   $0x78
  105672:	e9 55 f7 ff ff       	jmp    104dcc <alltraps>

00105677 <vector121>:
  105677:	6a 00                	push   $0x0
  105679:	6a 79                	push   $0x79
  10567b:	e9 4c f7 ff ff       	jmp    104dcc <alltraps>

00105680 <vector122>:
  105680:	6a 00                	push   $0x0
  105682:	6a 7a                	push   $0x7a
  105684:	e9 43 f7 ff ff       	jmp    104dcc <alltraps>

00105689 <vector123>:
  105689:	6a 00                	push   $0x0
  10568b:	6a 7b                	push   $0x7b
  10568d:	e9 3a f7 ff ff       	jmp    104dcc <alltraps>

00105692 <vector124>:
  105692:	6a 00                	push   $0x0
  105694:	6a 7c                	push   $0x7c
  105696:	e9 31 f7 ff ff       	jmp    104dcc <alltraps>

0010569b <vector125>:
  10569b:	6a 00                	push   $0x0
  10569d:	6a 7d                	push   $0x7d
  10569f:	e9 28 f7 ff ff       	jmp    104dcc <alltraps>

001056a4 <vector126>:
  1056a4:	6a 00                	push   $0x0
  1056a6:	6a 7e                	push   $0x7e
  1056a8:	e9 1f f7 ff ff       	jmp    104dcc <alltraps>

001056ad <vector127>:
  1056ad:	6a 00                	push   $0x0
  1056af:	6a 7f                	push   $0x7f
  1056b1:	e9 16 f7 ff ff       	jmp    104dcc <alltraps>

001056b6 <vector128>:
  1056b6:	6a 00                	push   $0x0
  1056b8:	68 80 00 00 00       	push   $0x80
  1056bd:	e9 0a f7 ff ff       	jmp    104dcc <alltraps>

001056c2 <vector129>:
  1056c2:	6a 00                	push   $0x0
  1056c4:	68 81 00 00 00       	push   $0x81
  1056c9:	e9 fe f6 ff ff       	jmp    104dcc <alltraps>

001056ce <vector130>:
  1056ce:	6a 00                	push   $0x0
  1056d0:	68 82 00 00 00       	push   $0x82
  1056d5:	e9 f2 f6 ff ff       	jmp    104dcc <alltraps>

001056da <vector131>:
  1056da:	6a 00                	push   $0x0
  1056dc:	68 83 00 00 00       	push   $0x83
  1056e1:	e9 e6 f6 ff ff       	jmp    104dcc <alltraps>

001056e6 <vector132>:
  1056e6:	6a 00                	push   $0x0
  1056e8:	68 84 00 00 00       	push   $0x84
  1056ed:	e9 da f6 ff ff       	jmp    104dcc <alltraps>

001056f2 <vector133>:
  1056f2:	6a 00                	push   $0x0
  1056f4:	68 85 00 00 00       	push   $0x85
  1056f9:	e9 ce f6 ff ff       	jmp    104dcc <alltraps>

001056fe <vector134>:
  1056fe:	6a 00                	push   $0x0
  105700:	68 86 00 00 00       	push   $0x86
  105705:	e9 c2 f6 ff ff       	jmp    104dcc <alltraps>

0010570a <vector135>:
  10570a:	6a 00                	push   $0x0
  10570c:	68 87 00 00 00       	push   $0x87
  105711:	e9 b6 f6 ff ff       	jmp    104dcc <alltraps>

00105716 <vector136>:
  105716:	6a 00                	push   $0x0
  105718:	68 88 00 00 00       	push   $0x88
  10571d:	e9 aa f6 ff ff       	jmp    104dcc <alltraps>

00105722 <vector137>:
  105722:	6a 00                	push   $0x0
  105724:	68 89 00 00 00       	push   $0x89
  105729:	e9 9e f6 ff ff       	jmp    104dcc <alltraps>

0010572e <vector138>:
  10572e:	6a 00                	push   $0x0
  105730:	68 8a 00 00 00       	push   $0x8a
  105735:	e9 92 f6 ff ff       	jmp    104dcc <alltraps>

0010573a <vector139>:
  10573a:	6a 00                	push   $0x0
  10573c:	68 8b 00 00 00       	push   $0x8b
  105741:	e9 86 f6 ff ff       	jmp    104dcc <alltraps>

00105746 <vector140>:
  105746:	6a 00                	push   $0x0
  105748:	68 8c 00 00 00       	push   $0x8c
  10574d:	e9 7a f6 ff ff       	jmp    104dcc <alltraps>

00105752 <vector141>:
  105752:	6a 00                	push   $0x0
  105754:	68 8d 00 00 00       	push   $0x8d
  105759:	e9 6e f6 ff ff       	jmp    104dcc <alltraps>

0010575e <vector142>:
  10575e:	6a 00                	push   $0x0
  105760:	68 8e 00 00 00       	push   $0x8e
  105765:	e9 62 f6 ff ff       	jmp    104dcc <alltraps>

0010576a <vector143>:
  10576a:	6a 00                	push   $0x0
  10576c:	68 8f 00 00 00       	push   $0x8f
  105771:	e9 56 f6 ff ff       	jmp    104dcc <alltraps>

00105776 <vector144>:
  105776:	6a 00                	push   $0x0
  105778:	68 90 00 00 00       	push   $0x90
  10577d:	e9 4a f6 ff ff       	jmp    104dcc <alltraps>

00105782 <vector145>:
  105782:	6a 00                	push   $0x0
  105784:	68 91 00 00 00       	push   $0x91
  105789:	e9 3e f6 ff ff       	jmp    104dcc <alltraps>

0010578e <vector146>:
  10578e:	6a 00                	push   $0x0
  105790:	68 92 00 00 00       	push   $0x92
  105795:	e9 32 f6 ff ff       	jmp    104dcc <alltraps>

0010579a <vector147>:
  10579a:	6a 00                	push   $0x0
  10579c:	68 93 00 00 00       	push   $0x93
  1057a1:	e9 26 f6 ff ff       	jmp    104dcc <alltraps>

001057a6 <vector148>:
  1057a6:	6a 00                	push   $0x0
  1057a8:	68 94 00 00 00       	push   $0x94
  1057ad:	e9 1a f6 ff ff       	jmp    104dcc <alltraps>

001057b2 <vector149>:
  1057b2:	6a 00                	push   $0x0
  1057b4:	68 95 00 00 00       	push   $0x95
  1057b9:	e9 0e f6 ff ff       	jmp    104dcc <alltraps>

001057be <vector150>:
  1057be:	6a 00                	push   $0x0
  1057c0:	68 96 00 00 00       	push   $0x96
  1057c5:	e9 02 f6 ff ff       	jmp    104dcc <alltraps>

001057ca <vector151>:
  1057ca:	6a 00                	push   $0x0
  1057cc:	68 97 00 00 00       	push   $0x97
  1057d1:	e9 f6 f5 ff ff       	jmp    104dcc <alltraps>

001057d6 <vector152>:
  1057d6:	6a 00                	push   $0x0
  1057d8:	68 98 00 00 00       	push   $0x98
  1057dd:	e9 ea f5 ff ff       	jmp    104dcc <alltraps>

001057e2 <vector153>:
  1057e2:	6a 00                	push   $0x0
  1057e4:	68 99 00 00 00       	push   $0x99
  1057e9:	e9 de f5 ff ff       	jmp    104dcc <alltraps>

001057ee <vector154>:
  1057ee:	6a 00                	push   $0x0
  1057f0:	68 9a 00 00 00       	push   $0x9a
  1057f5:	e9 d2 f5 ff ff       	jmp    104dcc <alltraps>

001057fa <vector155>:
  1057fa:	6a 00                	push   $0x0
  1057fc:	68 9b 00 00 00       	push   $0x9b
  105801:	e9 c6 f5 ff ff       	jmp    104dcc <alltraps>

00105806 <vector156>:
  105806:	6a 00                	push   $0x0
  105808:	68 9c 00 00 00       	push   $0x9c
  10580d:	e9 ba f5 ff ff       	jmp    104dcc <alltraps>

00105812 <vector157>:
  105812:	6a 00                	push   $0x0
  105814:	68 9d 00 00 00       	push   $0x9d
  105819:	e9 ae f5 ff ff       	jmp    104dcc <alltraps>

0010581e <vector158>:
  10581e:	6a 00                	push   $0x0
  105820:	68 9e 00 00 00       	push   $0x9e
  105825:	e9 a2 f5 ff ff       	jmp    104dcc <alltraps>

0010582a <vector159>:
  10582a:	6a 00                	push   $0x0
  10582c:	68 9f 00 00 00       	push   $0x9f
  105831:	e9 96 f5 ff ff       	jmp    104dcc <alltraps>

00105836 <vector160>:
  105836:	6a 00                	push   $0x0
  105838:	68 a0 00 00 00       	push   $0xa0
  10583d:	e9 8a f5 ff ff       	jmp    104dcc <alltraps>

00105842 <vector161>:
  105842:	6a 00                	push   $0x0
  105844:	68 a1 00 00 00       	push   $0xa1
  105849:	e9 7e f5 ff ff       	jmp    104dcc <alltraps>

0010584e <vector162>:
  10584e:	6a 00                	push   $0x0
  105850:	68 a2 00 00 00       	push   $0xa2
  105855:	e9 72 f5 ff ff       	jmp    104dcc <alltraps>

0010585a <vector163>:
  10585a:	6a 00                	push   $0x0
  10585c:	68 a3 00 00 00       	push   $0xa3
  105861:	e9 66 f5 ff ff       	jmp    104dcc <alltraps>

00105866 <vector164>:
  105866:	6a 00                	push   $0x0
  105868:	68 a4 00 00 00       	push   $0xa4
  10586d:	e9 5a f5 ff ff       	jmp    104dcc <alltraps>

00105872 <vector165>:
  105872:	6a 00                	push   $0x0
  105874:	68 a5 00 00 00       	push   $0xa5
  105879:	e9 4e f5 ff ff       	jmp    104dcc <alltraps>

0010587e <vector166>:
  10587e:	6a 00                	push   $0x0
  105880:	68 a6 00 00 00       	push   $0xa6
  105885:	e9 42 f5 ff ff       	jmp    104dcc <alltraps>

0010588a <vector167>:
  10588a:	6a 00                	push   $0x0
  10588c:	68 a7 00 00 00       	push   $0xa7
  105891:	e9 36 f5 ff ff       	jmp    104dcc <alltraps>

00105896 <vector168>:
  105896:	6a 00                	push   $0x0
  105898:	68 a8 00 00 00       	push   $0xa8
  10589d:	e9 2a f5 ff ff       	jmp    104dcc <alltraps>

001058a2 <vector169>:
  1058a2:	6a 00                	push   $0x0
  1058a4:	68 a9 00 00 00       	push   $0xa9
  1058a9:	e9 1e f5 ff ff       	jmp    104dcc <alltraps>

001058ae <vector170>:
  1058ae:	6a 00                	push   $0x0
  1058b0:	68 aa 00 00 00       	push   $0xaa
  1058b5:	e9 12 f5 ff ff       	jmp    104dcc <alltraps>

001058ba <vector171>:
  1058ba:	6a 00                	push   $0x0
  1058bc:	68 ab 00 00 00       	push   $0xab
  1058c1:	e9 06 f5 ff ff       	jmp    104dcc <alltraps>

001058c6 <vector172>:
  1058c6:	6a 00                	push   $0x0
  1058c8:	68 ac 00 00 00       	push   $0xac
  1058cd:	e9 fa f4 ff ff       	jmp    104dcc <alltraps>

001058d2 <vector173>:
  1058d2:	6a 00                	push   $0x0
  1058d4:	68 ad 00 00 00       	push   $0xad
  1058d9:	e9 ee f4 ff ff       	jmp    104dcc <alltraps>

001058de <vector174>:
  1058de:	6a 00                	push   $0x0
  1058e0:	68 ae 00 00 00       	push   $0xae
  1058e5:	e9 e2 f4 ff ff       	jmp    104dcc <alltraps>

001058ea <vector175>:
  1058ea:	6a 00                	push   $0x0
  1058ec:	68 af 00 00 00       	push   $0xaf
  1058f1:	e9 d6 f4 ff ff       	jmp    104dcc <alltraps>

001058f6 <vector176>:
  1058f6:	6a 00                	push   $0x0
  1058f8:	68 b0 00 00 00       	push   $0xb0
  1058fd:	e9 ca f4 ff ff       	jmp    104dcc <alltraps>

00105902 <vector177>:
  105902:	6a 00                	push   $0x0
  105904:	68 b1 00 00 00       	push   $0xb1
  105909:	e9 be f4 ff ff       	jmp    104dcc <alltraps>

0010590e <vector178>:
  10590e:	6a 00                	push   $0x0
  105910:	68 b2 00 00 00       	push   $0xb2
  105915:	e9 b2 f4 ff ff       	jmp    104dcc <alltraps>

0010591a <vector179>:
  10591a:	6a 00                	push   $0x0
  10591c:	68 b3 00 00 00       	push   $0xb3
  105921:	e9 a6 f4 ff ff       	jmp    104dcc <alltraps>

00105926 <vector180>:
  105926:	6a 00                	push   $0x0
  105928:	68 b4 00 00 00       	push   $0xb4
  10592d:	e9 9a f4 ff ff       	jmp    104dcc <alltraps>

00105932 <vector181>:
  105932:	6a 00                	push   $0x0
  105934:	68 b5 00 00 00       	push   $0xb5
  105939:	e9 8e f4 ff ff       	jmp    104dcc <alltraps>

0010593e <vector182>:
  10593e:	6a 00                	push   $0x0
  105940:	68 b6 00 00 00       	push   $0xb6
  105945:	e9 82 f4 ff ff       	jmp    104dcc <alltraps>

0010594a <vector183>:
  10594a:	6a 00                	push   $0x0
  10594c:	68 b7 00 00 00       	push   $0xb7
  105951:	e9 76 f4 ff ff       	jmp    104dcc <alltraps>

00105956 <vector184>:
  105956:	6a 00                	push   $0x0
  105958:	68 b8 00 00 00       	push   $0xb8
  10595d:	e9 6a f4 ff ff       	jmp    104dcc <alltraps>

00105962 <vector185>:
  105962:	6a 00                	push   $0x0
  105964:	68 b9 00 00 00       	push   $0xb9
  105969:	e9 5e f4 ff ff       	jmp    104dcc <alltraps>

0010596e <vector186>:
  10596e:	6a 00                	push   $0x0
  105970:	68 ba 00 00 00       	push   $0xba
  105975:	e9 52 f4 ff ff       	jmp    104dcc <alltraps>

0010597a <vector187>:
  10597a:	6a 00                	push   $0x0
  10597c:	68 bb 00 00 00       	push   $0xbb
  105981:	e9 46 f4 ff ff       	jmp    104dcc <alltraps>

00105986 <vector188>:
  105986:	6a 00                	push   $0x0
  105988:	68 bc 00 00 00       	push   $0xbc
  10598d:	e9 3a f4 ff ff       	jmp    104dcc <alltraps>

00105992 <vector189>:
  105992:	6a 00                	push   $0x0
  105994:	68 bd 00 00 00       	push   $0xbd
  105999:	e9 2e f4 ff ff       	jmp    104dcc <alltraps>

0010599e <vector190>:
  10599e:	6a 00                	push   $0x0
  1059a0:	68 be 00 00 00       	push   $0xbe
  1059a5:	e9 22 f4 ff ff       	jmp    104dcc <alltraps>

001059aa <vector191>:
  1059aa:	6a 00                	push   $0x0
  1059ac:	68 bf 00 00 00       	push   $0xbf
  1059b1:	e9 16 f4 ff ff       	jmp    104dcc <alltraps>

001059b6 <vector192>:
  1059b6:	6a 00                	push   $0x0
  1059b8:	68 c0 00 00 00       	push   $0xc0
  1059bd:	e9 0a f4 ff ff       	jmp    104dcc <alltraps>

001059c2 <vector193>:
  1059c2:	6a 00                	push   $0x0
  1059c4:	68 c1 00 00 00       	push   $0xc1
  1059c9:	e9 fe f3 ff ff       	jmp    104dcc <alltraps>

001059ce <vector194>:
  1059ce:	6a 00                	push   $0x0
  1059d0:	68 c2 00 00 00       	push   $0xc2
  1059d5:	e9 f2 f3 ff ff       	jmp    104dcc <alltraps>

001059da <vector195>:
  1059da:	6a 00                	push   $0x0
  1059dc:	68 c3 00 00 00       	push   $0xc3
  1059e1:	e9 e6 f3 ff ff       	jmp    104dcc <alltraps>

001059e6 <vector196>:
  1059e6:	6a 00                	push   $0x0
  1059e8:	68 c4 00 00 00       	push   $0xc4
  1059ed:	e9 da f3 ff ff       	jmp    104dcc <alltraps>

001059f2 <vector197>:
  1059f2:	6a 00                	push   $0x0
  1059f4:	68 c5 00 00 00       	push   $0xc5
  1059f9:	e9 ce f3 ff ff       	jmp    104dcc <alltraps>

001059fe <vector198>:
  1059fe:	6a 00                	push   $0x0
  105a00:	68 c6 00 00 00       	push   $0xc6
  105a05:	e9 c2 f3 ff ff       	jmp    104dcc <alltraps>

00105a0a <vector199>:
  105a0a:	6a 00                	push   $0x0
  105a0c:	68 c7 00 00 00       	push   $0xc7
  105a11:	e9 b6 f3 ff ff       	jmp    104dcc <alltraps>

00105a16 <vector200>:
  105a16:	6a 00                	push   $0x0
  105a18:	68 c8 00 00 00       	push   $0xc8
  105a1d:	e9 aa f3 ff ff       	jmp    104dcc <alltraps>

00105a22 <vector201>:
  105a22:	6a 00                	push   $0x0
  105a24:	68 c9 00 00 00       	push   $0xc9
  105a29:	e9 9e f3 ff ff       	jmp    104dcc <alltraps>

00105a2e <vector202>:
  105a2e:	6a 00                	push   $0x0
  105a30:	68 ca 00 00 00       	push   $0xca
  105a35:	e9 92 f3 ff ff       	jmp    104dcc <alltraps>

00105a3a <vector203>:
  105a3a:	6a 00                	push   $0x0
  105a3c:	68 cb 00 00 00       	push   $0xcb
  105a41:	e9 86 f3 ff ff       	jmp    104dcc <alltraps>

00105a46 <vector204>:
  105a46:	6a 00                	push   $0x0
  105a48:	68 cc 00 00 00       	push   $0xcc
  105a4d:	e9 7a f3 ff ff       	jmp    104dcc <alltraps>

00105a52 <vector205>:
  105a52:	6a 00                	push   $0x0
  105a54:	68 cd 00 00 00       	push   $0xcd
  105a59:	e9 6e f3 ff ff       	jmp    104dcc <alltraps>

00105a5e <vector206>:
  105a5e:	6a 00                	push   $0x0
  105a60:	68 ce 00 00 00       	push   $0xce
  105a65:	e9 62 f3 ff ff       	jmp    104dcc <alltraps>

00105a6a <vector207>:
  105a6a:	6a 00                	push   $0x0
  105a6c:	68 cf 00 00 00       	push   $0xcf
  105a71:	e9 56 f3 ff ff       	jmp    104dcc <alltraps>

00105a76 <vector208>:
  105a76:	6a 00                	push   $0x0
  105a78:	68 d0 00 00 00       	push   $0xd0
  105a7d:	e9 4a f3 ff ff       	jmp    104dcc <alltraps>

00105a82 <vector209>:
  105a82:	6a 00                	push   $0x0
  105a84:	68 d1 00 00 00       	push   $0xd1
  105a89:	e9 3e f3 ff ff       	jmp    104dcc <alltraps>

00105a8e <vector210>:
  105a8e:	6a 00                	push   $0x0
  105a90:	68 d2 00 00 00       	push   $0xd2
  105a95:	e9 32 f3 ff ff       	jmp    104dcc <alltraps>

00105a9a <vector211>:
  105a9a:	6a 00                	push   $0x0
  105a9c:	68 d3 00 00 00       	push   $0xd3
  105aa1:	e9 26 f3 ff ff       	jmp    104dcc <alltraps>

00105aa6 <vector212>:
  105aa6:	6a 00                	push   $0x0
  105aa8:	68 d4 00 00 00       	push   $0xd4
  105aad:	e9 1a f3 ff ff       	jmp    104dcc <alltraps>

00105ab2 <vector213>:
  105ab2:	6a 00                	push   $0x0
  105ab4:	68 d5 00 00 00       	push   $0xd5
  105ab9:	e9 0e f3 ff ff       	jmp    104dcc <alltraps>

00105abe <vector214>:
  105abe:	6a 00                	push   $0x0
  105ac0:	68 d6 00 00 00       	push   $0xd6
  105ac5:	e9 02 f3 ff ff       	jmp    104dcc <alltraps>

00105aca <vector215>:
  105aca:	6a 00                	push   $0x0
  105acc:	68 d7 00 00 00       	push   $0xd7
  105ad1:	e9 f6 f2 ff ff       	jmp    104dcc <alltraps>

00105ad6 <vector216>:
  105ad6:	6a 00                	push   $0x0
  105ad8:	68 d8 00 00 00       	push   $0xd8
  105add:	e9 ea f2 ff ff       	jmp    104dcc <alltraps>

00105ae2 <vector217>:
  105ae2:	6a 00                	push   $0x0
  105ae4:	68 d9 00 00 00       	push   $0xd9
  105ae9:	e9 de f2 ff ff       	jmp    104dcc <alltraps>

00105aee <vector218>:
  105aee:	6a 00                	push   $0x0
  105af0:	68 da 00 00 00       	push   $0xda
  105af5:	e9 d2 f2 ff ff       	jmp    104dcc <alltraps>

00105afa <vector219>:
  105afa:	6a 00                	push   $0x0
  105afc:	68 db 00 00 00       	push   $0xdb
  105b01:	e9 c6 f2 ff ff       	jmp    104dcc <alltraps>

00105b06 <vector220>:
  105b06:	6a 00                	push   $0x0
  105b08:	68 dc 00 00 00       	push   $0xdc
  105b0d:	e9 ba f2 ff ff       	jmp    104dcc <alltraps>

00105b12 <vector221>:
  105b12:	6a 00                	push   $0x0
  105b14:	68 dd 00 00 00       	push   $0xdd
  105b19:	e9 ae f2 ff ff       	jmp    104dcc <alltraps>

00105b1e <vector222>:
  105b1e:	6a 00                	push   $0x0
  105b20:	68 de 00 00 00       	push   $0xde
  105b25:	e9 a2 f2 ff ff       	jmp    104dcc <alltraps>

00105b2a <vector223>:
  105b2a:	6a 00                	push   $0x0
  105b2c:	68 df 00 00 00       	push   $0xdf
  105b31:	e9 96 f2 ff ff       	jmp    104dcc <alltraps>

00105b36 <vector224>:
  105b36:	6a 00                	push   $0x0
  105b38:	68 e0 00 00 00       	push   $0xe0
  105b3d:	e9 8a f2 ff ff       	jmp    104dcc <alltraps>

00105b42 <vector225>:
  105b42:	6a 00                	push   $0x0
  105b44:	68 e1 00 00 00       	push   $0xe1
  105b49:	e9 7e f2 ff ff       	jmp    104dcc <alltraps>

00105b4e <vector226>:
  105b4e:	6a 00                	push   $0x0
  105b50:	68 e2 00 00 00       	push   $0xe2
  105b55:	e9 72 f2 ff ff       	jmp    104dcc <alltraps>

00105b5a <vector227>:
  105b5a:	6a 00                	push   $0x0
  105b5c:	68 e3 00 00 00       	push   $0xe3
  105b61:	e9 66 f2 ff ff       	jmp    104dcc <alltraps>

00105b66 <vector228>:
  105b66:	6a 00                	push   $0x0
  105b68:	68 e4 00 00 00       	push   $0xe4
  105b6d:	e9 5a f2 ff ff       	jmp    104dcc <alltraps>

00105b72 <vector229>:
  105b72:	6a 00                	push   $0x0
  105b74:	68 e5 00 00 00       	push   $0xe5
  105b79:	e9 4e f2 ff ff       	jmp    104dcc <alltraps>

00105b7e <vector230>:
  105b7e:	6a 00                	push   $0x0
  105b80:	68 e6 00 00 00       	push   $0xe6
  105b85:	e9 42 f2 ff ff       	jmp    104dcc <alltraps>

00105b8a <vector231>:
  105b8a:	6a 00                	push   $0x0
  105b8c:	68 e7 00 00 00       	push   $0xe7
  105b91:	e9 36 f2 ff ff       	jmp    104dcc <alltraps>

00105b96 <vector232>:
  105b96:	6a 00                	push   $0x0
  105b98:	68 e8 00 00 00       	push   $0xe8
  105b9d:	e9 2a f2 ff ff       	jmp    104dcc <alltraps>

00105ba2 <vector233>:
  105ba2:	6a 00                	push   $0x0
  105ba4:	68 e9 00 00 00       	push   $0xe9
  105ba9:	e9 1e f2 ff ff       	jmp    104dcc <alltraps>

00105bae <vector234>:
  105bae:	6a 00                	push   $0x0
  105bb0:	68 ea 00 00 00       	push   $0xea
  105bb5:	e9 12 f2 ff ff       	jmp    104dcc <alltraps>

00105bba <vector235>:
  105bba:	6a 00                	push   $0x0
  105bbc:	68 eb 00 00 00       	push   $0xeb
  105bc1:	e9 06 f2 ff ff       	jmp    104dcc <alltraps>

00105bc6 <vector236>:
  105bc6:	6a 00                	push   $0x0
  105bc8:	68 ec 00 00 00       	push   $0xec
  105bcd:	e9 fa f1 ff ff       	jmp    104dcc <alltraps>

00105bd2 <vector237>:
  105bd2:	6a 00                	push   $0x0
  105bd4:	68 ed 00 00 00       	push   $0xed
  105bd9:	e9 ee f1 ff ff       	jmp    104dcc <alltraps>

00105bde <vector238>:
  105bde:	6a 00                	push   $0x0
  105be0:	68 ee 00 00 00       	push   $0xee
  105be5:	e9 e2 f1 ff ff       	jmp    104dcc <alltraps>

00105bea <vector239>:
  105bea:	6a 00                	push   $0x0
  105bec:	68 ef 00 00 00       	push   $0xef
  105bf1:	e9 d6 f1 ff ff       	jmp    104dcc <alltraps>

00105bf6 <vector240>:
  105bf6:	6a 00                	push   $0x0
  105bf8:	68 f0 00 00 00       	push   $0xf0
  105bfd:	e9 ca f1 ff ff       	jmp    104dcc <alltraps>

00105c02 <vector241>:
  105c02:	6a 00                	push   $0x0
  105c04:	68 f1 00 00 00       	push   $0xf1
  105c09:	e9 be f1 ff ff       	jmp    104dcc <alltraps>

00105c0e <vector242>:
  105c0e:	6a 00                	push   $0x0
  105c10:	68 f2 00 00 00       	push   $0xf2
  105c15:	e9 b2 f1 ff ff       	jmp    104dcc <alltraps>

00105c1a <vector243>:
  105c1a:	6a 00                	push   $0x0
  105c1c:	68 f3 00 00 00       	push   $0xf3
  105c21:	e9 a6 f1 ff ff       	jmp    104dcc <alltraps>

00105c26 <vector244>:
  105c26:	6a 00                	push   $0x0
  105c28:	68 f4 00 00 00       	push   $0xf4
  105c2d:	e9 9a f1 ff ff       	jmp    104dcc <alltraps>

00105c32 <vector245>:
  105c32:	6a 00                	push   $0x0
  105c34:	68 f5 00 00 00       	push   $0xf5
  105c39:	e9 8e f1 ff ff       	jmp    104dcc <alltraps>

00105c3e <vector246>:
  105c3e:	6a 00                	push   $0x0
  105c40:	68 f6 00 00 00       	push   $0xf6
  105c45:	e9 82 f1 ff ff       	jmp    104dcc <alltraps>

00105c4a <vector247>:
  105c4a:	6a 00                	push   $0x0
  105c4c:	68 f7 00 00 00       	push   $0xf7
  105c51:	e9 76 f1 ff ff       	jmp    104dcc <alltraps>

00105c56 <vector248>:
  105c56:	6a 00                	push   $0x0
  105c58:	68 f8 00 00 00       	push   $0xf8
  105c5d:	e9 6a f1 ff ff       	jmp    104dcc <alltraps>

00105c62 <vector249>:
  105c62:	6a 00                	push   $0x0
  105c64:	68 f9 00 00 00       	push   $0xf9
  105c69:	e9 5e f1 ff ff       	jmp    104dcc <alltraps>

00105c6e <vector250>:
  105c6e:	6a 00                	push   $0x0
  105c70:	68 fa 00 00 00       	push   $0xfa
  105c75:	e9 52 f1 ff ff       	jmp    104dcc <alltraps>

00105c7a <vector251>:
  105c7a:	6a 00                	push   $0x0
  105c7c:	68 fb 00 00 00       	push   $0xfb
  105c81:	e9 46 f1 ff ff       	jmp    104dcc <alltraps>

00105c86 <vector252>:
  105c86:	6a 00                	push   $0x0
  105c88:	68 fc 00 00 00       	push   $0xfc
  105c8d:	e9 3a f1 ff ff       	jmp    104dcc <alltraps>

00105c92 <vector253>:
  105c92:	6a 00                	push   $0x0
  105c94:	68 fd 00 00 00       	push   $0xfd
  105c99:	e9 2e f1 ff ff       	jmp    104dcc <alltraps>

00105c9e <vector254>:
  105c9e:	6a 00                	push   $0x0
  105ca0:	68 fe 00 00 00       	push   $0xfe
  105ca5:	e9 22 f1 ff ff       	jmp    104dcc <alltraps>

00105caa <vector255>:
  105caa:	6a 00                	push   $0x0
  105cac:	68 ff 00 00 00       	push   $0xff
  105cb1:	e9 16 f1 ff ff       	jmp    104dcc <alltraps>
